1
0
mirror of https://github.com/php/phd.git synced 2026-03-24 07:02:07 +01:00
Files
archived-phd/tests/setup.php
haszi e6e6847d7b Refactor Options Parser and default Options Handler (#110)
* Refactor Options Parser and default Options Handler

Refactor default Options Handler to accept dependencies through its constructor.
Refactor default Options Handler to return an array of options instead of directly setting options in Config and declare array return types.
Refactor method in Options Parser to return an array of options and declare its return type as array.
Inject all necessary dependencies in render.php.
Refactor two methods in default Options Handler by using match expressions.

* Minor refactor of files used in tests

Inlcude Config with require_once instead of require in Autloader.
Define __INSTALLDIR__ only if it is not defined yet in render.php.
Include Autoloader and functions.php with require_once instead of require.
Remove unnecessary __PHPDIR__ constant, correct path for __INSTALLDIR__ and use that constant in setup.php.

* Remove var_dump from Options Parser

* Fix inconsistent option flags in default Option Handler

* Add default Options Handler tests

---------

Co-authored-by: haszi <haszika80@gmail.com>
2024-03-17 18:29:43 +00:00

17 lines
748 B
PHP

<?php
namespace phpdotnet\phd;
define("__INSTALLDIR__", "@php_dir@" == "@"."php_dir@" ? dirname(__DIR__) : "@php_dir@");
require_once __INSTALLDIR__ . DIRECTORY_SEPARATOR . "phpdotnet" . DIRECTORY_SEPARATOR . "phd" . DIRECTORY_SEPARATOR . "Autoloader.php";
spl_autoload_register(["phpdotnet\\phd\\Autoloader", "autoload"]);
require_once __INSTALLDIR__ . DIRECTORY_SEPARATOR . "phpdotnet" . DIRECTORY_SEPARATOR . "phd" . DIRECTORY_SEPARATOR . "functions.php";
Config::init([
"lang_dir" => __INSTALLDIR__ . DIRECTORY_SEPARATOR
. "phpdotnet" . DIRECTORY_SEPARATOR . "phd" . DIRECTORY_SEPARATOR
. "data" . DIRECTORY_SEPARATOR . "langs" . DIRECTORY_SEPARATOR,
"package_dirs" => [__INSTALLDIR__],
]);