1 | <?php |
||
25 | class NestedSet implements TreeInterface |
||
26 | { |
||
27 | private $adapter; |
||
28 | |||
29 | private $validator; |
||
30 | |||
31 | /** |
||
32 | * @param Options|array $options |
||
33 | * @param object $dbAdapter |
||
34 | * |
||
35 | * @return TreeInterface |
||
36 | * |
||
37 | * @throws InvalidArgumentException |
||
38 | */ |
||
39 | 7 | public static function factory($options, $dbAdapter): TreeInterface |
|
62 | |||
63 | /** |
||
64 | * @param AdapterInterface $adapter |
||
65 | */ |
||
66 | 62 | public function __construct(AdapterInterface $adapter) |
|
70 | |||
71 | /** |
||
72 | * @return AdapterInterface |
||
73 | */ |
||
74 | 62 | public function getAdapter(): AdapterInterface |
|
78 | |||
79 | /** |
||
80 | * @return ValidatorInterface |
||
81 | */ |
||
82 | 8 | private function getValidator(): ValidatorInterface |
|
90 | |||
91 | /** |
||
92 | * {@inheritdoc} |
||
93 | */ |
||
94 | 5 | public function createRootNode($data = array(), $scope = null) |
|
110 | |||
111 | /** |
||
112 | * {@inheritdoc} |
||
113 | */ |
||
114 | 2 | public function updateNode($nodeId, array $data): void |
|
119 | |||
120 | /** |
||
121 | * {@inheritdoc} |
||
122 | */ |
||
123 | 9 | public function addNode($targetNodeId, array $data = array(), string $placement = self::PLACEMENT_CHILD_TOP) |
|
127 | |||
128 | /** |
||
129 | * @param string $placement |
||
130 | * |
||
131 | * @return AddStrategyInterface |
||
132 | * |
||
133 | * @throws InvalidArgumentException |
||
134 | */ |
||
135 | 9 | protected function getAddStrategy(string $placement): AddStrategyInterface |
|
152 | |||
153 | /** |
||
154 | * {@inheritdoc} |
||
155 | */ |
||
156 | 13 | public function moveNode($sourceNodeId, $targetNodeId, string $placement = self::PLACEMENT_CHILD_TOP): void |
|
160 | |||
161 | /** |
||
162 | * @param string $placement |
||
163 | * |
||
164 | * @return MoveStrategyInterface |
||
165 | * |
||
166 | * @throws InvalidArgumentException |
||
167 | */ |
||
168 | 13 | protected function getMoveStrategy(string $placement): MoveStrategyInterface |
|
185 | |||
186 | /** |
||
187 | * {@inheritdoc} |
||
188 | */ |
||
189 | 3 | public function deleteBranch($nodeId): void |
|
221 | |||
222 | /** |
||
223 | * {@inheritdoc} |
||
224 | */ |
||
225 | 4 | public function getPath($nodeId, int $startLevel = 0, bool $excludeLastNode = false): array |
|
230 | |||
231 | /** |
||
232 | * {@inheritdoc} |
||
233 | */ |
||
234 | 3 | public function getNode($nodeId): ?array |
|
239 | |||
240 | /** |
||
241 | * {@inheritdoc} |
||
242 | */ |
||
243 | 7 | public function getDescendantsQueryBuilder(): DescendantQueryBuilderInterface |
|
247 | |||
248 | /** |
||
249 | * {@inheritdoc} |
||
250 | */ |
||
251 | 7 | public function getRootNode($scope = null): array |
|
256 | |||
257 | /** |
||
258 | * {@inheritdoc} |
||
259 | */ |
||
260 | 1 | public function getRoots(): array |
|
265 | |||
266 | /** |
||
267 | * {@inheritdoc} |
||
268 | */ |
||
269 | 5 | public function isValid($rootNodeId): bool |
|
274 | |||
275 | /** |
||
276 | * {@inheritdoc} |
||
277 | */ |
||
278 | 3 | public function rebuild($rootNodeId): void |
|
283 | } |
||
284 |