@@ -287,7 +287,7 @@ |
||
287 | 287 | * Load nodes by id. |
288 | 288 | * |
289 | 289 | * @param string $class Force check node type |
290 | - * @param bool $deleted |
|
290 | + * @param integer $deleted |
|
291 | 291 | */ |
292 | 292 | public function findNodesById(array $id = [], ?string $class = null, int $deleted = NodeInterface::DELETED_INCLUDE): Generator |
293 | 293 | { |
@@ -12,7 +12,6 @@ |
||
12 | 12 | namespace Balloon\Migration\Delta; |
13 | 13 | |
14 | 14 | use MongoDB\Database; |
15 | -use MongoDB\Driver\Exception\CommandException; |
|
16 | 15 | use MongoDB\Driver\Exception\RuntimeException; |
17 | 16 | |
18 | 17 | class Md5BlobIgnoreNull implements DeltaInterface |
@@ -365,7 +365,7 @@ |
||
365 | 365 | if (!$this->_acl->isAllowed($this, 'm')) { |
366 | 366 | throw new ForbiddenException( |
367 | 367 | 'not allowed to update acl', |
368 | - ForbiddenException::NOT_ALLOWED_TO_MANAGE |
|
368 | + ForbiddenException::NOT_ALLOWED_TO_MANAGE |
|
369 | 369 | ); |
370 | 370 | } |
371 | 371 |
@@ -120,20 +120,20 @@ discard block |
||
120 | 120 | 'mime' => (string) $attributes['mime'], |
121 | 121 | 'readonly' => (bool) $attributes['readonly'], |
122 | 122 | 'directory' => $node instanceof Collection, |
123 | - 'meta' => function ($node) { |
|
123 | + 'meta' => function($node) { |
|
124 | 124 | return (object) $node->getMetaAttributes(); |
125 | 125 | }, |
126 | - 'size' => function ($node) { |
|
126 | + 'size' => function($node) { |
|
127 | 127 | return $node->getSize(); |
128 | 128 | }, |
129 | - 'path' => function ($node) { |
|
129 | + 'path' => function($node) { |
|
130 | 130 | try { |
131 | 131 | return $node->getPath(); |
132 | 132 | } catch (\Exception $e) { |
133 | 133 | return null; |
134 | 134 | } |
135 | 135 | }, |
136 | - 'parent' => function ($node) { |
|
136 | + 'parent' => function($node) { |
|
137 | 137 | $parent = $node->getParent(); |
138 | 138 | |
139 | 139 | if (null === $parent || $parent->isRoot()) { |
@@ -142,17 +142,17 @@ discard block |
||
142 | 142 | |
143 | 143 | return $this->decorate($node->getParent(), ['id', 'name', '_links']); |
144 | 144 | }, |
145 | - 'access' => function ($node) use ($acl) { |
|
145 | + 'access' => function($node) use ($acl) { |
|
146 | 146 | return $acl->getAclPrivilege($node); |
147 | 147 | }, |
148 | - 'acl' => function ($node) use ($attributes) { |
|
148 | + 'acl' => function($node) use ($attributes) { |
|
149 | 149 | if ($node->isShareMember() && count($attributes['acl']) > 0) { |
150 | 150 | return $node->getAcl(); |
151 | 151 | } |
152 | 152 | |
153 | 153 | return null; |
154 | 154 | }, |
155 | - 'share' => function ($node) { |
|
155 | + 'share' => function($node) { |
|
156 | 156 | if ($node->isShared() || !$node->isSpecial()) { |
157 | 157 | return null; |
158 | 158 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | return null; |
164 | 164 | } |
165 | 165 | }, |
166 | - 'sharename' => function ($node) { |
|
166 | + 'sharename' => function($node) { |
|
167 | 167 | if (!$node->isShared()) { |
168 | 168 | return null; |
169 | 169 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | return null; |
175 | 175 | } |
176 | 176 | }, |
177 | - 'shareowner' => function ($node) use ($server, $fs, $decorator) { |
|
177 | + 'shareowner' => function($node) use ($server, $fs, $decorator) { |
|
178 | 178 | if (!$node->isSpecial()) { |
179 | 179 | return null; |
180 | 180 | } |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | return null; |
189 | 189 | } |
190 | 190 | }, |
191 | - 'owner' => function ($node) use ($server, $decorator) { |
|
191 | + 'owner' => function($node) use ($server, $decorator) { |
|
192 | 192 | try { |
193 | 193 | return $decorator->decorate( |
194 | 194 | $server->getUserById($node->getOwner()), |
@@ -209,20 +209,20 @@ discard block |
||
209 | 209 | protected function getTimeAttributes(NodeInterface $node, array $attributes): array |
210 | 210 | { |
211 | 211 | return [ |
212 | - 'created' => function ($node) use ($attributes) { |
|
212 | + 'created' => function($node) use ($attributes) { |
|
213 | 213 | return $attributes['created']->toDateTime()->format('c'); |
214 | 214 | }, |
215 | - 'changed' => function ($node) use ($attributes) { |
|
215 | + 'changed' => function($node) use ($attributes) { |
|
216 | 216 | return $attributes['changed']->toDateTime()->format('c'); |
217 | 217 | }, |
218 | - 'deleted' => function ($node) use ($attributes) { |
|
218 | + 'deleted' => function($node) use ($attributes) { |
|
219 | 219 | if (false === $attributes['deleted']) { |
220 | 220 | return null; |
221 | 221 | } |
222 | 222 | |
223 | 223 | return $attributes['deleted']->toDateTime()->format('c'); |
224 | 224 | }, |
225 | - 'destroy' => function ($node) use ($attributes) { |
|
225 | + 'destroy' => function($node) use ($attributes) { |
|
226 | 226 | if (null === $attributes['destroy']) { |
227 | 227 | return null; |
228 | 228 | } |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | return [ |
253 | 253 | 'shared' => $node->isShared(), |
254 | 254 | 'reference' => $node->isReference(), |
255 | - 'filter' => function ($node) use ($attributes) { |
|
255 | + 'filter' => function($node) use ($attributes) { |
|
256 | 256 | if (null === $attributes['filter']) { |
257 | 257 | return null; |
258 | 258 | } |
@@ -770,8 +770,8 @@ |
||
770 | 770 | { |
771 | 771 | if (!$this->_acl->isAllowed($this, 'm')) { |
772 | 772 | throw new ForbiddenException( |
773 | - 'not allowed to set acl', |
|
774 | - ForbiddenException::NOT_ALLOWED_TO_MANAGE |
|
773 | + 'not allowed to set acl', |
|
774 | + ForbiddenException::NOT_ALLOWED_TO_MANAGE |
|
775 | 775 | ); |
776 | 776 | } |
777 | 777 |
@@ -236,8 +236,8 @@ discard block |
||
236 | 236 | $share = $node->getFilesystem()->findRawNode($node->getShareId()); |
237 | 237 | } catch (\Exception $e) { |
238 | 238 | $this->logger->error('could not find share node ['.$node->getShareId().'] for reference ['.$node->getId().'], dead reference?', [ |
239 | - 'category' => get_class($this), |
|
240 | - 'exception' => $e, |
|
239 | + 'category' => get_class($this), |
|
240 | + 'exception' => $e, |
|
241 | 241 | ]); |
242 | 242 | |
243 | 243 | return self::PRIVILEGE_DENY; |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | |
246 | 246 | if ($share['deleted'] instanceof UTCDateTime || true !== $share['shared']) { |
247 | 247 | $this->logger->error('share node ['.$share['_id'].'] has been deleted, dead reference?', [ |
248 | - 'category' => get_class($this), |
|
248 | + 'category' => get_class($this), |
|
249 | 249 | ]); |
250 | 250 | |
251 | 251 | return self::PRIVILEGE_DENY; |
@@ -92,13 +92,13 @@ discard block |
||
92 | 92 | } |
93 | 93 | |
94 | 94 | return [ |
95 | - 'created' => function ($role) use ($attributes) { |
|
95 | + 'created' => function($role) use ($attributes) { |
|
96 | 96 | return $attributes['created']->toDateTime()->format('c'); |
97 | 97 | }, |
98 | - 'changed' => function ($role) use ($attributes) { |
|
98 | + 'changed' => function($role) use ($attributes) { |
|
99 | 99 | return $attributes['changed']->toDateTime()->format('c'); |
100 | 100 | }, |
101 | - 'deleted' => function ($role) use ($attributes) { |
|
101 | + 'deleted' => function($role) use ($attributes) { |
|
102 | 102 | if (false === $attributes['deleted']) { |
103 | 103 | return null; |
104 | 104 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | 'name' => (string) $attributes['username'], |
147 | 147 | 'admin' => (bool) $attributes['admin'], |
148 | 148 | 'namespace' => isset($attributes['namespace']) ? (string) $attributes['namespace'] : null, |
149 | - 'mail' => function ($role) use ($attributes, $user) { |
|
149 | + 'mail' => function($role) use ($attributes, $user) { |
|
150 | 150 | if (!isset($attributes['mail'])) { |
151 | 151 | return null; |
152 | 152 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | 'locale' => isset($attributes['locale']) ? (string) $attributes['locale'] : null, |
161 | 161 | 'hard_quota' => isset($attributes['hard_quota']) ? (int) $attributes['hard_quota'] : null, |
162 | 162 | 'soft_quota' => isset($attributes['soft_quota']) ? (int) $attributes['soft_quota'] : null, |
163 | - 'available' => function ($role) use (&$quota, $attributes, $user) { |
|
163 | + 'available' => function($role) use (&$quota, $attributes, $user) { |
|
164 | 164 | $quota === null ? $quota = $role->getQuotaUsage() : null; |
165 | 165 | if ($attributes['_id'] == $user->getId() || $user->isAdmin()) { |
166 | 166 | return $quota['available']; |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | |
169 | 169 | return null; |
170 | 170 | }, |
171 | - 'used' => function ($role) use (&$quota, $attributes, $user) { |
|
171 | + 'used' => function($role) use (&$quota, $attributes, $user) { |
|
172 | 172 | $quota === null ? $quota = $role->getQuotaUsage() : null; |
173 | 173 | if ($attributes['_id'] == $user->getId() || $user->isAdmin()) { |
174 | 174 | return $quota['used']; |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | } |
188 | 188 | } |
189 | 189 | |
190 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict, $move) { |
|
190 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict, $move) { |
|
191 | 191 | if (true === $move) { |
192 | 192 | $node = $node->setParent($parent, $conflict); |
193 | 193 | } |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | |
271 | 271 | return $response |
272 | 272 | ->setOutputFormat(null) |
273 | - ->setBody(function () use ($node, $offset, $limit) { |
|
273 | + ->setBody(function() use ($node, $offset, $limit) { |
|
274 | 274 | $stream = $node->get(); |
275 | 275 | $name = $node->getName(); |
276 | 276 | |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | return (new Response())->setCode(200)->setBody($result); |
402 | 402 | } |
403 | 403 | |
404 | - return $this->bulk($id, $p, function ($node) use ($attributes) { |
|
404 | + return $this->bulk($id, $p, function($node) use ($attributes) { |
|
405 | 405 | return [ |
406 | 406 | 'code' => 200, |
407 | 407 | 'data' => $this->node_decorator->decorate($node, $attributes), |
@@ -509,9 +509,9 @@ discard block |
||
509 | 509 | public function patch(?string $name = null, ?array $meta = null, ?bool $readonly = null, ?array $filter = null, ?array $acl = null, ?string $id = null, ?string $p = null): Response |
510 | 510 | { |
511 | 511 | $attributes = compact('name', 'meta', 'readonly', 'filter', 'acl'); |
512 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
512 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
513 | 513 | |
514 | - return $this->bulk($id, $p, function ($node) use ($attributes) { |
|
514 | + return $this->bulk($id, $p, function($node) use ($attributes) { |
|
515 | 515 | foreach ($attributes as $attribute => $value) { |
516 | 516 | switch ($attribute) { |
517 | 517 | case 'name': |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | ); |
595 | 595 | } |
596 | 596 | |
597 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict) { |
|
597 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict) { |
|
598 | 598 | $result = $node->copyTo($parent, $conflict); |
599 | 599 | |
600 | 600 | return [ |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | ); |
656 | 656 | } |
657 | 657 | |
658 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict) { |
|
658 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict) { |
|
659 | 659 | $result = $node->setParent($parent, $conflict); |
660 | 660 | |
661 | 661 | return [ |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | $at = $this->_verifyAttributes(['destroy' => $at])['destroy']; |
706 | 706 | } |
707 | 707 | |
708 | - return $this->bulk($id, $p, function ($node) use ($force, $ignore_flag, $at) { |
|
708 | + return $this->bulk($id, $p, function($node) use ($force, $ignore_flag, $at) { |
|
709 | 709 | if (null === $at) { |
710 | 710 | $node->delete($force && $node->isDeleted() || $force && $ignore_flag); |
711 | 711 | } else { |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | |
282 | 282 | if ($index === $chunks) { |
283 | 283 | $attributes = compact('changed', 'created', 'readonly', 'meta', 'acl'); |
284 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
284 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
285 | 285 | $attributes = $this->_verifyAttributes($attributes); |
286 | 286 | |
287 | 287 | return $this->_put($session, $id, $p, $collection, $name, $attributes, $conflict); |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | $session = $this->storage->storeTemporaryFile($input, $this->server->getIdentity()); |
396 | 396 | |
397 | 397 | $attributes = compact('changed', 'created', 'readonly', 'meta', 'acl'); |
398 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
398 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
399 | 399 | $attributes = $this->_verifyAttributes($attributes); |
400 | 400 | |
401 | 401 | return $this->_put($session, $id, $p, $collection, $name, $attributes, $conflict); |