public function __construct(array $visitor, ReflectionContext $ref, GraphContext $grf, Graph $g) { if (!count($visitor)) { throw new \InvalidArgumentException("The visitors list cannot be empty"); } $this->graphCtx = $grf; $this->graph = $g; $this->reflectionCtx = $ref; foreach ($visitor as $k => $v) { if (!$v instanceof State\State) { throw new \InvalidArgumentException("Invalid visitor for index {$k}"); } $v->setContext($this); $this->stateList[$v->getName()] = $v; } $this->stateStack[0] = ['node' => null, 'state' => $visitor[0], 'key' => $visitor[0]->getName()]; }
public function __construct(ReflectionContext $ref, GraphContext $grf, Graph $g) { $visitor = [new \Trismegiste\Mondrian\Visitor\State\PackageLevel(), new FileLevel(), new ClassLevel(), new InterfaceLevel(), new TraitLevel()]; parent::__construct($visitor, $ref, $grf, $g); }