@@ 9-45 (lines=37) @@ | ||
6 | ||
7 | use Hoa\Ruler\Model as AST; |
|
8 | ||
9 | class OperatorCollectorVisitor extends Visitor |
|
10 | { |
|
11 | /** |
|
12 | * @var array |
|
13 | */ |
|
14 | private $operators = []; |
|
15 | ||
16 | /** |
|
17 | * {@inheritdoc} |
|
18 | */ |
|
19 | public function getCompilationData(): array |
|
20 | { |
|
21 | return [ |
|
22 | 'operators' => $this->operators, |
|
23 | ]; |
|
24 | } |
|
25 | ||
26 | /** |
|
27 | * {@inheritdoc} |
|
28 | */ |
|
29 | public function visitModel(AST\Model $element, &$handle = null, $eldnah = null) |
|
30 | { |
|
31 | parent::visitModel($element, $handle, $eldnah); |
|
32 | ||
33 | return $this->operators; |
|
34 | } |
|
35 | ||
36 | /** |
|
37 | * {@inheritdoc} |
|
38 | */ |
|
39 | public function visitOperator(AST\Operator $element, &$handle = null, $eldnah = null) |
|
40 | { |
|
41 | parent::visitOperator($element, $handle, $eldnah); |
|
42 | ||
43 | $this->operators[] = $element; |
|
44 | } |
|
45 | } |
|
46 |
@@ 10-44 (lines=35) @@ | ||
7 | use Hoa\Ruler\Model as AST; |
|
8 | use RulerZ\Model; |
|
9 | ||
10 | class ParameterCollectorVisitor extends Visitor |
|
11 | { |
|
12 | /** |
|
13 | * @var array |
|
14 | */ |
|
15 | private $parameters = []; |
|
16 | ||
17 | /** |
|
18 | * {@inheritdoc} |
|
19 | */ |
|
20 | public function getCompilationData(): array |
|
21 | { |
|
22 | return [ |
|
23 | 'parameters' => $this->parameters, |
|
24 | ]; |
|
25 | } |
|
26 | ||
27 | /** |
|
28 | * {@inheritdoc} |
|
29 | */ |
|
30 | public function visitParameter(Model\Parameter $element, &$handle = null, $eldnah = null) |
|
31 | { |
|
32 | $this->parameters[$element->getName()] = $element; |
|
33 | } |
|
34 | ||
35 | /** |
|
36 | * {@inheritdoc} |
|
37 | */ |
|
38 | public function visitModel(AST\Model $element, &$handle = null, $eldnah = null) |
|
39 | { |
|
40 | parent::visitModel($element, $handle, $eldnah); |
|
41 | ||
42 | return $this->parameters; |
|
43 | } |
|
44 | } |
|
45 |