1 | <?php |
||
25 | abstract class BaseSpecification implements Specification |
||
26 | { |
||
27 | /** |
||
28 | * @var string|null |
||
29 | */ |
||
30 | private $context; |
||
31 | |||
32 | /** |
||
33 | * @param string|null $context |
||
34 | */ |
||
35 | public function __construct($context = null) |
||
39 | |||
40 | /** |
||
41 | * @param QueryBuilder $qb |
||
42 | * @param string $context |
||
43 | * |
||
44 | * @return string |
||
45 | */ |
||
46 | public function getFilter(QueryBuilder $qb, string $context): string |
||
56 | |||
57 | /** |
||
58 | * @param QueryBuilder $qb |
||
59 | * @param string $context |
||
60 | */ |
||
61 | public function modify(QueryBuilder $qb, string $context): void |
||
69 | |||
70 | /** |
||
71 | * {@inheritdoc} |
||
72 | */ |
||
73 | public function filterCollection(iterable $collection): iterable |
||
83 | |||
84 | /** |
||
85 | * {@inheritdoc} |
||
86 | */ |
||
87 | public function isSatisfiedBy($candidate): bool |
||
97 | |||
98 | /** |
||
99 | * Return all the specifications. |
||
100 | * |
||
101 | * @return Filter|QueryModifier |
||
102 | */ |
||
103 | abstract protected function getSpec(); |
||
104 | |||
105 | /** |
||
106 | * @param string $context |
||
107 | * |
||
108 | * @return string |
||
109 | */ |
||
110 | private function getContext(string $context): string |
||
118 | |||
119 | /** |
||
120 | * @param string $context |
||
121 | * |
||
122 | * @return string |
||
123 | */ |
||
124 | protected function getNestedContext(string $context): string |
||
132 | } |
||
133 |