@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | return []; |
118 | 118 | } |
119 | 119 | |
120 | - usort($this->tags, function ($a, $b) { |
|
120 | + usort($this->tags, function($a, $b) { |
|
121 | 121 | return strnatcasecmp($a->getName(), $b->getName()); |
122 | 122 | }); |
123 | 123 | $tagMap = []; |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public function getTagsForUser(string $user): array { |
141 | 141 | return array_filter($this->tags, |
142 | - function ($tag) use ($user) { |
|
142 | + function($tag) use ($user) { |
|
143 | 143 | return $tag->getOwner() === $user; |
144 | 144 | } |
145 | 145 | ); |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $qb->setParameter('chunk', $chunk, IQueryBuilder::PARAM_INT_ARRAY); |
171 | 171 | $result = $qb->executeQuery(); |
172 | 172 | while ($row = $result->fetch()) { |
173 | - $objId = (int)$row['objid']; |
|
173 | + $objId = (int) $row['objid']; |
|
174 | 174 | if (!isset($entries[$objId])) { |
175 | 175 | $entries[$objId] = []; |
176 | 176 | } |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | } elseif (is_string($tag)) { |
206 | 206 | $tag = trim($tag); |
207 | 207 | if ($tag === '') { |
208 | - $this->logger->debug(__METHOD__ . ' Cannot use empty tag names', ['app' => 'core']); |
|
208 | + $this->logger->debug(__METHOD__.' Cannot use empty tag names', ['app' => 'core']); |
|
209 | 209 | return false; |
210 | 210 | } |
211 | 211 | $tagId = $this->getTagId($tag); |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | } |
235 | 235 | |
236 | 236 | while ($row = $result->fetch()) { |
237 | - $ids[] = (int)$row['objid']; |
|
237 | + $ids[] = (int) $row['objid']; |
|
238 | 238 | } |
239 | 239 | $result->closeCursor(); |
240 | 240 | |
@@ -271,11 +271,11 @@ discard block |
||
271 | 271 | $name = trim($name); |
272 | 272 | |
273 | 273 | if ($name === '') { |
274 | - $this->logger->debug(__METHOD__ . ' Cannot add an empty tag', ['app' => 'core']); |
|
274 | + $this->logger->debug(__METHOD__.' Cannot add an empty tag', ['app' => 'core']); |
|
275 | 275 | return false; |
276 | 276 | } |
277 | 277 | if ($this->userHasTag($name, $this->user)) { |
278 | - $this->logger->debug(__METHOD__ . ' Tag with name already exists', ['app' => 'core']); |
|
278 | + $this->logger->debug(__METHOD__.' Tag with name already exists', ['app' => 'core']); |
|
279 | 279 | return false; |
280 | 280 | } |
281 | 281 | try { |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | ]); |
290 | 290 | return false; |
291 | 291 | } |
292 | - $this->logger->debug(__METHOD__ . ' Added an tag with ' . $tag->getId(), ['app' => 'core']); |
|
292 | + $this->logger->debug(__METHOD__.' Added an tag with '.$tag->getId(), ['app' => 'core']); |
|
293 | 293 | return $tag->getId(); |
294 | 294 | } |
295 | 295 | |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | $to = trim($to); |
306 | 306 | |
307 | 307 | if ($to === '' || $from === '') { |
308 | - $this->logger->debug(__METHOD__ . 'Cannot use an empty tag names', ['app' => 'core']); |
|
308 | + $this->logger->debug(__METHOD__.'Cannot use an empty tag names', ['app' => 'core']); |
|
309 | 309 | return false; |
310 | 310 | } |
311 | 311 | |
@@ -315,13 +315,13 @@ discard block |
||
315 | 315 | $key = $this->getTagByName($from); |
316 | 316 | } |
317 | 317 | if ($key === false) { |
318 | - $this->logger->debug(__METHOD__ . 'Tag ' . $from . 'does not exist', ['app' => 'core']); |
|
318 | + $this->logger->debug(__METHOD__.'Tag '.$from.'does not exist', ['app' => 'core']); |
|
319 | 319 | return false; |
320 | 320 | } |
321 | 321 | $tag = $this->tags[$key]; |
322 | 322 | |
323 | 323 | if ($this->userHasTag($to, $tag->getOwner())) { |
324 | - $this->logger->debug(__METHOD__ . 'A tag named' . $to . 'already exists for user' . $tag->getOwner(), ['app' => 'core']); |
|
324 | + $this->logger->debug(__METHOD__.'A tag named'.$to.'already exists for user'.$tag->getOwner(), ['app' => 'core']); |
|
325 | 325 | return false; |
326 | 326 | } |
327 | 327 | |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | |
392 | 392 | // reload tags to get the proper ids. |
393 | 393 | $this->tags = $this->mapper->loadTags($this->owners, $this->type); |
394 | - $this->logger->debug(__METHOD__ . 'tags' . print_r($this->tags, true), ['app' => 'core']); |
|
394 | + $this->logger->debug(__METHOD__.'tags'.print_r($this->tags, true), ['app' => 'core']); |
|
395 | 395 | // Loop through temporarily cached objectid/tagname pairs |
396 | 396 | // and save relations. |
397 | 397 | $tags = $this->tags; |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | ksort($tags); |
400 | 400 | foreach (self::$relations as $relation) { |
401 | 401 | $tagId = $this->getTagId($relation['tag']); |
402 | - $this->logger->debug(__METHOD__ . 'catid ' . $relation['tag'] . ' ' . $tagId, ['app' => 'core']); |
|
402 | + $this->logger->debug(__METHOD__.'catid '.$relation['tag'].' '.$tagId, ['app' => 'core']); |
|
403 | 403 | if ($tagId) { |
404 | 404 | $qb = $this->db->getQueryBuilder(); |
405 | 405 | $qb->insert(self::RELATION_TABLE) |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | if (is_string($tag) && !is_numeric($tag)) { |
503 | 503 | $tag = trim($tag); |
504 | 504 | if ($tag === '') { |
505 | - $this->logger->debug(__METHOD__ . ', Cannot add an empty tag'); |
|
505 | + $this->logger->debug(__METHOD__.', Cannot add an empty tag'); |
|
506 | 506 | return false; |
507 | 507 | } |
508 | 508 | if (!$this->hasTag($tag)) { |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | if ($node !== null) { |
535 | 535 | $path = $node->getPath(); |
536 | 536 | } else { |
537 | - throw new Exception('Failed to favorite: node with id ' . $objid . ' not found'); |
|
537 | + throw new Exception('Failed to favorite: node with id '.$objid.' not found'); |
|
538 | 538 | } |
539 | 539 | } |
540 | 540 | |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | if (is_string($tag) && !is_numeric($tag)) { |
551 | 551 | $tag = trim($tag); |
552 | 552 | if ($tag === '') { |
553 | - $this->logger->debug(__METHOD__ . ', Tag name is empty'); |
|
553 | + $this->logger->debug(__METHOD__.', Tag name is empty'); |
|
554 | 554 | return false; |
555 | 555 | } |
556 | 556 | $tagId = $this->getTagId($tag); |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | if ($node !== null) { |
580 | 580 | $path = $node->getPath(); |
581 | 581 | } else { |
582 | - throw new Exception('Failed to unfavorite: node with id ' . $objid . ' not found'); |
|
582 | + throw new Exception('Failed to unfavorite: node with id '.$objid.' not found'); |
|
583 | 583 | } |
584 | 584 | } |
585 | 585 | |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | $names = array_map('trim', $names); |
603 | 603 | array_filter($names); |
604 | 604 | |
605 | - $this->logger->debug(__METHOD__ . ', before: ' . print_r($this->tags, true)); |
|
605 | + $this->logger->debug(__METHOD__.', before: '.print_r($this->tags, true)); |
|
606 | 606 | foreach ($names as $name) { |
607 | 607 | $id = null; |
608 | 608 | |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | unset($this->tags[$key]); |
618 | 618 | $this->mapper->delete($tag); |
619 | 619 | } else { |
620 | - $this->logger->error(__METHOD__ . 'Cannot delete tag ' . $name . ': not found.'); |
|
620 | + $this->logger->error(__METHOD__.'Cannot delete tag '.$name.': not found.'); |
|
621 | 621 | } |
622 | 622 | if (!is_null($id) && $id !== false) { |
623 | 623 | try { |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | return false; |
644 | 644 | } |
645 | 645 | return array_search(strtolower($needle), array_map( |
646 | - function ($tag) use ($mem) { |
|
646 | + function($tag) use ($mem) { |
|
647 | 647 | return strtolower(call_user_func([$tag, $mem])); |
648 | 648 | }, $haystack) |
649 | 649 | ); |
@@ -212,9 +212,9 @@ discard block |
||
212 | 212 | )) { |
213 | 213 | // note: pre-fetching only supported for depth <= 1 |
214 | 214 | $folderContent = $collection->getChildren(); |
215 | - $fileIds = [(int)$collection->getId()]; |
|
215 | + $fileIds = [(int) $collection->getId()]; |
|
216 | 216 | foreach ($folderContent as $info) { |
217 | - $fileIds[] = (int)$info->getId(); |
|
217 | + $fileIds[] = (int) $info->getId(); |
|
218 | 218 | } |
219 | 219 | $this->prefetchTagsForFileIds($fileIds); |
220 | 220 | $this->cachedDirectories[$collection->getPath()] = true; |
@@ -239,12 +239,12 @@ discard block |
||
239 | 239 | |
240 | 240 | $isFav = null; |
241 | 241 | |
242 | - $propFind->handle(self::TAGS_PROPERTYNAME, function () use (&$isFav, $node) { |
|
242 | + $propFind->handle(self::TAGS_PROPERTYNAME, function() use (&$isFav, $node) { |
|
243 | 243 | [$tags, $isFav] = $this->getTagsAndFav($node->getId()); |
244 | 244 | return new TagList($tags); |
245 | 245 | }); |
246 | 246 | |
247 | - $propFind->handle(self::FAVORITE_PROPERTYNAME, function () use ($isFav, $node) { |
|
247 | + $propFind->handle(self::FAVORITE_PROPERTYNAME, function() use ($isFav, $node) { |
|
248 | 248 | if (is_null($isFav)) { |
249 | 249 | [, $isFav] = $this->getTagsAndFav($node->getId()); |
250 | 250 | } |
@@ -270,13 +270,13 @@ discard block |
||
270 | 270 | return; |
271 | 271 | } |
272 | 272 | |
273 | - $propPatch->handle(self::TAGS_PROPERTYNAME, function ($tagList) use ($node, $path) { |
|
273 | + $propPatch->handle(self::TAGS_PROPERTYNAME, function($tagList) use ($node, $path) { |
|
274 | 274 | $this->updateTags($node->getId(), $tagList->getTags(), $path); |
275 | 275 | return true; |
276 | 276 | }); |
277 | 277 | |
278 | - $propPatch->handle(self::FAVORITE_PROPERTYNAME, function ($favState) use ($node, $path) { |
|
279 | - if ((int)$favState === 1 || $favState === 'true') { |
|
278 | + $propPatch->handle(self::FAVORITE_PROPERTYNAME, function($favState) use ($node, $path) { |
|
279 | + if ((int) $favState === 1 || $favState === 'true') { |
|
280 | 280 | $this->getTagger()->tagAs($node->getId(), self::TAG_FAVORITE, $path); |
281 | 281 | } else { |
282 | 282 | $this->getTagger()->unTag($node->getId(), self::TAG_FAVORITE, $path); |