The Php code reverse is a plug-out directly written in C++.
Note that the Php code reverse cannot be used as a Php code round trip and doesn't allows to update already defined classes having at least one member.
The Php code reverse plug-out may be applied only on a package.
When you start the Php code reverse, it ask for a directory, then it reads all the sources placed under the selected directory and sub-directories. The sources read by the Php code reverse are the ones having the extension specified in the generation settings. The tree formed by the sub-directories produce an equivalent tree of sub-packages, on whose the needed class view and deployment view are made to support the classes and artifacts. When a type is referenced but not defined in the reverse files, a class having the same name is defined under an additional package named unknown.
The reverse/roundtrip setting dialog of the modeler allows to specify through regular expression the files and / or directories whose must not be taken into account during a reverse and roundtrip, for instance to bypass test programs.
Obviously the Php code reverse tries to produce the definitions made in BOUML at the artifact / class / operation / relation / attribute levels. When it is possible it creates a relation rather than an attribute.
The Php code reverse works in two steps, during the first step it scans all the files to establish the list of defined types, then the second step may reverse the files.
When the Php code reverse has a problem, for instance on a syntax error, it produces a warning in the trace window. The trace window is automatically opened by BOUML, it may also be manually opened through the Tools menu.
The reversed files are considered composed in three parts :
a header without class not interface definition and containing "<?php". This part if placed at the beginning of the generated artifact
a part starting with the first class or interface and finishing with a class or an interface without containing any use nor namespace. The reversed classes and interfaces must be at the toplevel, this means not embedded in a if or other form. The possible non class forms between the classes/interfaces are supported by an extra artifact definition. This part produces ${definition} in the definition of the artifact
the rest if the file, probably containing the marker "?>", this part is placed at the end of the definition of the artifact.
When the reverse is done, the number of reversed classes, operations, attributes and relations is written, for instance in case I reverse the sources of Joomla 1.5RC :
Previous : Php generator
Next : Php roundtrip