Analysers implements the Visitor pattern in a simple and effective way to make the render of your results truly customizable.
Each Analyser
class must implement interface Bartlett\Reflect\Visitor\VisitorInterface
.
![]() | |
Abstract visitor is a component of Reflect, and not CompatInfo. Take care of namespace ! |
<?php namespace Bartlett\Reflect\Visitor; use Bartlett\Reflect\Model\Visitable; interface VisitorInterface { public function visit(Visitable $visitable); }
Each element that need to be explored by your analyser should have a visit method accordingly.
![]() | |
Abstract class |
<?php use Bartlett\Reflect\Visitor\AbstractVisitor; class Analyser extends AbstractVisitor { public function visitPackageModel($package) { } public function visitClassModel($class) { } public function visitMethodModel($method) { } public function visitPropertyModel($property) { } public function visitFunctionModel($function) { } public function visitConstantModel($constant) { } public function visitIncludeModel($include) { } public function visitDependencyModel($dependency) { } }
![]() | |
An abstract class Your analyser became as simple like that: <?php use Bartlett\Reflect\Analyser\AbstractAnalyser; class Analyser extends AbstractAnalyser { } |