Skip to content

Commit

Permalink
Refactor Options Parser and default Options Handler (php#110)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
haszi and haszi authored Mar 17, 2024
1 parent 172da75 commit e6e6847
Show file tree
Hide file tree
Showing 15 changed files with 804 additions and 168 deletions.
2 changes: 1 addition & 1 deletion phpdotnet/phd/Autoloader.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace phpdotnet\phd;

require __DIR__ . DIRECTORY_SEPARATOR . 'Config.php';
require_once __DIR__ . DIRECTORY_SEPARATOR . 'Config.php';

class Autoloader
{
Expand Down
Loading

0 comments on commit e6e6847

Please sign in to comment.