1 | <?php |
||
27 | class NestedSet implements TreeInterface |
||
28 | { |
||
29 | private $adapter; |
||
30 | |||
31 | private $validator; |
||
32 | |||
33 | /** |
||
34 | * @param Options|array $options |
||
35 | * @param object $dbAdapter |
||
36 | * |
||
37 | * @return TreeInterface |
||
38 | * |
||
39 | * @throws InvalidArgumentException |
||
40 | */ |
||
41 | 7 | public static function factory($options, $dbAdapter): TreeInterface |
|
64 | |||
65 | /** |
||
66 | * @param AdapterInterface $adapter |
||
67 | */ |
||
68 | 65 | public function __construct(AdapterInterface $adapter) |
|
72 | |||
73 | /** |
||
74 | * @return AdapterInterface |
||
75 | */ |
||
76 | 65 | public function getAdapter(): AdapterInterface |
|
80 | |||
81 | /** |
||
82 | * @return ValidatorInterface |
||
83 | */ |
||
84 | 8 | private function getValidator(): ValidatorInterface |
|
92 | |||
93 | /** |
||
94 | * {@inheritdoc} |
||
95 | */ |
||
96 | 5 | public function createRootNode($data = array(), $scope = null) |
|
112 | |||
113 | /** |
||
114 | * {@inheritdoc} |
||
115 | */ |
||
116 | 2 | public function updateNode($nodeId, array $data): void |
|
121 | |||
122 | /** |
||
123 | * {@inheritdoc} |
||
124 | */ |
||
125 | 10 | public function addNode($targetNodeId, array $data = array(), string $placement = self::PLACEMENT_CHILD_TOP) |
|
129 | |||
130 | /** |
||
131 | * @param string $placement |
||
132 | * |
||
133 | * @return AddStrategyInterface |
||
134 | * |
||
135 | * @throws InvalidArgumentException |
||
136 | */ |
||
137 | 10 | protected function getAddStrategy(string $placement): AddStrategyInterface |
|
154 | |||
155 | /** |
||
156 | * {@inheritdoc} |
||
157 | */ |
||
158 | 13 | public function moveNode($sourceNodeId, $targetNodeId, string $placement = self::PLACEMENT_CHILD_TOP): void |
|
162 | |||
163 | /** |
||
164 | * @param string $placement |
||
165 | * |
||
166 | * @return MoveStrategyInterface |
||
167 | * |
||
168 | * @throws InvalidArgumentException |
||
169 | */ |
||
170 | 13 | protected function getMoveStrategy(string $placement): MoveStrategyInterface |
|
187 | |||
188 | /** |
||
189 | * {@inheritdoc} |
||
190 | */ |
||
191 | 3 | public function deleteBranch($nodeId): void |
|
223 | |||
224 | /** |
||
225 | * {@inheritdoc} |
||
226 | */ |
||
227 | 3 | public function getNode($nodeId): ?array |
|
232 | |||
233 | /** |
||
234 | * {@inheritdoc} |
||
235 | */ |
||
236 | 5 | public function getAncestorsQueryBuilder(): AncestorQueryBuilderInterface |
|
240 | |||
241 | /** |
||
242 | * {@inheritdoc} |
||
243 | */ |
||
244 | 8 | public function getDescendantsQueryBuilder(): DescendantQueryBuilderInterface |
|
248 | |||
249 | /** |
||
250 | * {@inheritdoc} |
||
251 | */ |
||
252 | 7 | public function getRootNode($scope = null): array |
|
257 | |||
258 | /** |
||
259 | * {@inheritdoc} |
||
260 | */ |
||
261 | 1 | public function getRoots(): array |
|
266 | |||
267 | /** |
||
268 | * {@inheritdoc} |
||
269 | */ |
||
270 | 5 | public function isValid($rootNodeId): bool |
|
275 | |||
276 | /** |
||
277 | * {@inheritdoc} |
||
278 | */ |
||
279 | 3 | public function rebuild($rootNodeId): void |
|
284 | } |
||
285 |