It is important that you document your code correctly so that Gammelsaeters PHP2XMI can know what datatypes your parameters have and what datatypes your functions return.
You can give typehinting to parameters which are objects or arrays in the function declaration, but for the other types you will have to document them in the method/function documentation block. The parameters $names and $tree has typehinting in the example below ($names is datatype array and $tree is datatype (or of the object type) TreeStructure.
// Example on function declaration with typehinting: public function __construct(array $names, TreeStructure $tree, $gen = 0) { echo "Hi!"; }
The documentation block is the block just above the function declaration which starts with "/**" and ends with "*/". It is necessary that you describe in this documentation which datatypes your function parameters have. Do this by using the @param keyword followed by the datatype and the name of the parameter.
If you document a parameter which also has typehinting (for example the $list parameter in the example below), the documentation value will override the typehinting value in the UML diagram you create.
When typehinting a parameter as an array, you actually do not say what kind of array this is. If you intend this parameter to be an array of integers, then write int[] in the documentation. The parameter $list is a good example on this below.
Deprecated – elements not used anymore If you are going to stop using an element, then do not delete it from the code, but rather mark it as deprecated with the @deprecated keyword in the comment block. You can choose to leave out all elements marked deprecated in the UML diagram.
Read more about documenting PHP code at PHPDocumentor.
This is an example of how to document a method correctly:
/** * Set object state. * * @param string $title The title of the object * @param Control $ctrl * @param int[] $list * @return boolean */ public function set_info($title, Control $ctrl, array $list) { $this->title = $title; $this->control = $ctrl; $this->list = $list; return true; }
The parameters $ctrl and $list are typehinted in the function declaration. The datatype in the documentation block is overriding the typehinting values when the UML diagram is generated. The UML diagram will have the value Control for $ctrl and int[] for $list.
Since you are only allowed to upload one file, the file you upload should contain all the objects you want to be included in the UML diagram. Please make sure that all classes and interfaces that these classes extends and implements also should be included.