Code details

The code is namespaced ; main namespace name is g5.
Code is PSR-4 (namespace hierarchy corresponds to directory hierarchy, like in java).
Top-level namespace (g5) is located in src/.
Another top-level namespace is used (vendor), located in vendor/.
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 g5\commands.

Association CLI - executed code

The command line interface (CLI) is handled by 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 execute().
  • Following parameters are passed in an array to the method execute()

php run-g5.php ertel sport look date
triggers the execution of

One exception

This 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 gauq to have a sub-namespace A1 and a sub-namespace A2 etc.
To handle this situation, a new convention was added:
  • If namespace corresponding to parameter 1 contains a class implementing the Command interface, the program transmits the control to this class.
  • Otherwise, default mechanism is used.
This is for example the case of g5\commands\gauq\GauqCommand.

Implementation of these conventions can be found in the namespace hierarchy, and in the code of class g5\app\Run