Architecture overview
Each processor is a specialized version of a graphical engine. UmlWriter version 1.0.0 is able to render only two diagram syntaxes :
But you are free to make your own. Here is the class diagram of processors architecture built with PlantUML processor
With the CLI mode, use the umlwriter command.
$ umlwriter diagram:render:namespace --processor=plantuml /path/to/umlwriter Bartlett\UmlWriter\Processor
Output return the PlantUML diagram syntax, that you may redirect directly to a file
Then build a png
image.
$ java -jar plantuml.jar -Tpng /path/to/puml_file -o /path/to/ouput/dir
Any new processor must implement the Bartlett\UmlWriter\Processor\ProcessorInterface
interface.
And to avoid to implement again and again the same methods, you should used
the abstract Bartlett\UmlWriter\Processor\AbstractProcessor
class, that will do
the job for you.
There are three methods to implement :
-
renderClass()
that is in charge of return diagram syntax of a single class and its direct dependencies. -
renderNamespace()
that is in charge of return diagram syntax of a single namespace and all its objects. -
render()
that is in charge of return diagram syntax of all namespaces and objects.
Methods
There are additional protected methods available in the abstract
Bartlett\UmlWriter\Processor\AbstractProcessor
class.
-
renderEdges()
that is in charge of building all links between objects (class, interface, trait) -
formatLine()
that may format line with a left indentation. -
writeObjectElement()
that render details of each object (class, interface, trait) in a namespace -
writeObjectInheritance()
that render the class or interface parent. -
writeObjectInterfaces()
that render all interfaces implemented by a class -
`writeConstantElements()`that render all constants of a class
-
writePropertyElements()
that render all properties of a class -
writeMethodElements()
that render all methods of any objects (class, interface, trait)
There are two abstract methods you should implement :
-
pushObject()
to render an object with all details (attributes, operations) -
pushEdge()
to render links (inheritances, implements) between objects
Other specialized methods that each processor must implement :
-
writeGraphHeader()
to render header of the main graph -
writeGraphFooter()
to render footer of the main graph
Limitations
The PlantUML processor is not yet able to print the PHP namespace \ (backslash), that is replaced by the . (dot)