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