Code is PSR-4 (namespace hierarchy corresponds to directory hierarchy, like in java).
Top-level namespace (
g5) is located in
Another top-level namespace is used (
vendor), located in
The code does not use composer or other dependency manager, vendor code is copied in
vendor/directory and versioned with the program.
All transformations on data are done in namespace
run-g5.php. To interpret the parameters typed by the user, a convention is used:
- The 3 first parameters are used to determine which class will be executed.
- These parameters correspond to the namespace hierarchy containing the executed class.
- The executed class must implement an interface,
g5\app\Command, which impose to provide a method called
- Following parameters are passed in an array to the method
php run-g5.php ertel sport look datetriggers the execution of
One exceptionThis basic and rigid mechanism proved to be sufficient for most cases. It is convenient because it permits to add new commands which can be used directly without having to change a configuration, but couldn't fill the need to handle Gauquelin files of series A. For example, to have the ability to issue commands like
php run-g5.php gauq A1 tmp2db
php run-g5.php gauq A2 tmp2db
would impose namespace
gauqto have a sub-namespace
A1and a sub-namespace
To handle this situation, a new convention was added:
- If namespace corresponding to parameter 1 contains a class implementing the
Commandinterface, the program transmits the control to this class.
- Otherwise, default mechanism is used.
Implementation of these conventions can be found in the namespace hierarchy, and in the code of class