1 | <?php |
||
16 | abstract class AbstractCompilationTarget implements CompilationTarget |
||
17 | { |
||
18 | /** |
||
19 | * @var OperatorsDefinitions |
||
20 | */ |
||
21 | private $customOperators; |
||
22 | |||
23 | /** |
||
24 | * Create a rule visitor for a given compilation context. |
||
25 | * |
||
26 | * @param Context $context The compilation context. |
||
27 | * |
||
28 | * @return \RulerZ\Compiler\RuleVisitor |
||
29 | */ |
||
30 | abstract protected function createVisitor(Context $context); |
||
31 | |||
32 | abstract protected function getExecutorTraits(); |
||
33 | |||
34 | /** |
||
35 | * @param array<callable> $operators A list of additional operators to register. |
||
36 | * @param array<callable> $inlineOperators A list of additional inline operators to register. |
||
37 | */ |
||
38 | public function __construct(array $operators = [], array $inlineOperators = []) |
||
42 | |||
43 | /** |
||
44 | * {@inheritdoc} |
||
45 | */ |
||
46 | public function compile(Model\Rule $rule, Context $compilationContext): Model\Executor |
||
57 | |||
58 | /** |
||
59 | * {@inheritdoc} |
||
60 | */ |
||
61 | public function createCompilationContext($target): Context |
||
65 | |||
66 | /** |
||
67 | * {@inheritdoc} |
||
68 | */ |
||
69 | public function defineOperator(string $name, callable $transformer): void |
||
73 | |||
74 | /** |
||
75 | * {@inheritdoc} |
||
76 | */ |
||
77 | public function defineInlineOperator(string $name, callable $transformer): void |
||
81 | |||
82 | /** |
||
83 | * {@inheritdoc} |
||
84 | */ |
||
85 | public function getOperators(): Definitions |
||
89 | |||
90 | /** |
||
91 | * {@inheritdoc} |
||
92 | */ |
||
93 | public function getRuleIdentifierHint(string $rule, Context $context): string |
||
97 | } |
||
98 |