@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | /** |
65 | 65 | * posting index |
66 | 66 | * |
67 | - * @return void|\Cake\Network\Response |
|
67 | + * @return \Cake\Http\Response|null |
|
68 | 68 | */ |
69 | 69 | public function index() |
70 | 70 | { |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * Mix view |
112 | 112 | * |
113 | 113 | * @param string $tid thread-ID |
114 | - * @return void|Response |
|
114 | + * @return \Cake\Http\Response|null |
|
115 | 115 | * @throws NotFoundException |
116 | 116 | */ |
117 | 117 | public function mix($tid) |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | * View posting. |
185 | 185 | * |
186 | 186 | * @param string $id posting-ID |
187 | - * @return \Cake\Network\Response|void |
|
187 | + * @return \Cake\Http\Response|null |
|
188 | 188 | */ |
189 | 189 | public function view($id = null) |
190 | 190 | { |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | * Add new posting. |
237 | 237 | * |
238 | 238 | * @param null|string $id parent-ID if is answer |
239 | - * @return void|\Cake\Network\Response |
|
239 | + * @return \Cake\Http\Response|null |
|
240 | 240 | * @throws ForbiddenException |
241 | 241 | */ |
242 | 242 | public function add($id = null) |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | * Get thread-line to insert after an inline-answer |
346 | 346 | * |
347 | 347 | * @param string $id posting-ID |
348 | - * @return void|\Cake\Network\Response |
|
348 | + * @return \Cake\Http\Response|null |
|
349 | 349 | */ |
350 | 350 | public function threadLine($id = null) |
351 | 351 | { |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | * Edit posting |
365 | 365 | * |
366 | 366 | * @param string $id posting-ID |
367 | - * @return void|\Cake\Network\Response |
|
367 | + * @return \Cake\Http\Response|null |
|
368 | 368 | * @throws NotFoundException |
369 | 369 | * @throws BadRequestException |
370 | 370 | */ |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | * @param string $id posting-ID |
571 | 571 | * @param string $toggle property |
572 | 572 | * |
573 | - * @return \Cake\Network\Response |
|
573 | + * @return \Cake\Http\Response |
|
574 | 574 | */ |
575 | 575 | public function ajaxToggle($id = null, $toggle = null) |
576 | 576 | { |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | $threads = $this->Threads->paginate($order); |
82 | 82 | $this->set('entries', $threads); |
83 | 83 | |
84 | - $currentPage = (int)$this->request->getQuery('page') ?: 1; |
|
84 | + $currentPage = (int) $this->request->getQuery('page') ?: 1; |
|
85 | 85 | if ($currentPage > 1) { |
86 | - $this->set('titleForLayout', __('page') . ' ' . $currentPage); |
|
86 | + $this->set('titleForLayout', __('page').' '.$currentPage); |
|
87 | 87 | } |
88 | 88 | if ($currentPage === 1) { |
89 | 89 | if ($this->MarkAsRead->refresh()) { |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function mix($tid) |
118 | 118 | { |
119 | - $tid = (int)$tid; |
|
119 | + $tid = (int) $tid; |
|
120 | 120 | if ($tid <= 0) { |
121 | 121 | throw new BadRequestException(); |
122 | 122 | } |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | $redirect = '/'; |
486 | 486 | } else { |
487 | 487 | $message = __('delete_subtree_success'); |
488 | - $redirect = '/entries/view/' . $posting->get('pid'); |
|
488 | + $redirect = '/entries/view/'.$posting->get('pid'); |
|
489 | 489 | } |
490 | 490 | } else { |
491 | 491 | $flashType = 'error'; |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | $targetId = $this->request->getData('targetId'); |
553 | 553 | if (!empty($targetId)) { |
554 | 554 | if ($this->Entries->threadMerge($sourceId, $targetId)) { |
555 | - $this->redirect('/entries/view/' . $sourceId); |
|
555 | + $this->redirect('/entries/view/'.$sourceId); |
|
556 | 556 | |
557 | 557 | return; |
558 | 558 | } else { |
@@ -583,11 +583,11 @@ discard block |
||
583 | 583 | throw new BadRequestException; |
584 | 584 | } |
585 | 585 | |
586 | - $current = $this->Entries->toggle((int)$id, $toggle); |
|
586 | + $current = $this->Entries->toggle((int) $id, $toggle); |
|
587 | 587 | if ($current) { |
588 | - $out['html'] = __d('nondynamic', $toggle . '_unset_entry_link'); |
|
588 | + $out['html'] = __d('nondynamic', $toggle.'_unset_entry_link'); |
|
589 | 589 | } else { |
590 | - $out['html'] = __d('nondynamic', $toggle . '_set_entry_link'); |
|
590 | + $out['html'] = __d('nondynamic', $toggle.'_set_entry_link'); |
|
591 | 591 | } |
592 | 592 | |
593 | 593 | $this->response = $this->response->withType('json'); |
@@ -9,7 +9,6 @@ discard block |
||
9 | 9 | |
10 | 10 | namespace App\Controller; |
11 | 11 | |
12 | -use App\Controller\Component\CurrentUserComponent; |
|
13 | 12 | use App\Controller\Component\MarkAsReadComponent; |
14 | 13 | use App\Controller\Component\ThreadsComponent; |
15 | 14 | use App\Model\Entity\Entry; |
@@ -21,9 +20,7 @@ discard block |
||
21 | 20 | use Cake\Http\Exception\ForbiddenException; |
22 | 21 | use Cake\Http\Exception\MethodNotAllowedException; |
23 | 22 | use Cake\Http\Exception\NotFoundException; |
24 | -use Cake\I18n\Time; |
|
25 | 23 | use Cake\Routing\RequestActionTrait; |
26 | -use Saito\App\Registry; |
|
27 | 24 | use Saito\Posting\Posting; |
28 | 25 | use Saito\User\ForumsUserInterface; |
29 | 26 | use Stopwatch\Lib\Stopwatch; |
@@ -26,7 +26,7 @@ |
||
26 | 26 | /** |
27 | 27 | * Generate posting preview for JSON frontend. |
28 | 28 | * |
29 | - * @return \Cake\Network\Response|void |
|
29 | + * @return null|\Cake\Http\Response |
|
30 | 30 | * @throws BadRequestException |
31 | 31 | * @throws ForbiddenException |
32 | 32 | */ |
@@ -68,9 +68,9 @@ |
||
68 | 68 | $jsonApiErrors = ['errors' => []]; |
69 | 69 | foreach ($errors as $field => $error) { |
70 | 70 | $out = [ |
71 | - 'meta' => ['field' => '#' . $this->_domId($field)], |
|
71 | + 'meta' => ['field' => '#'.$this->_domId($field)], |
|
72 | 72 | 'status' => '400', |
73 | - 'title' => __d('nondynamic', $field) . ": " . __d('nondynamic', current($error)), |
|
73 | + 'title' => __d('nondynamic', $field).": ".__d('nondynamic', current($error)), |
|
74 | 74 | ]; |
75 | 75 | |
76 | 76 | $jsonApiErrors['errors'][] = $out; |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | /** |
15 | 15 | * Current app status ping |
16 | 16 | * |
17 | - * @return string |
|
17 | + * @return \Cake\Http\Response |
|
18 | 18 | * @throws BadRequestException |
19 | 19 | */ |
20 | 20 | public function status() |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * Get status as JSON response |
56 | 56 | * |
57 | 57 | * @param string $data json-encoded data |
58 | - * @return mixed |
|
58 | + * @return string |
|
59 | 59 | */ |
60 | 60 | protected function _statusAsJson($data) |
61 | 61 | { |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Cake\Event\Event; |
6 | 6 | use Cake\Http\Exception\BadRequestException; |
7 | -use Cake\ORM\TableRegistry; |
|
8 | 7 | |
9 | 8 | class StatusController extends AppController |
10 | 9 | { |
@@ -46,7 +46,7 @@ |
||
46 | 46 | $this->response->disableCache(); |
47 | 47 | $out = ''; |
48 | 48 | $out .= "retry: $retry\n"; |
49 | - $out .= 'data: ' . $data . "\n\n"; |
|
49 | + $out .= 'data: '.$data."\n\n"; |
|
50 | 50 | |
51 | 51 | return $out; |
52 | 52 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | /** |
57 | 57 | * Login user. |
58 | 58 | * |
59 | - * @return void|\Cake\Network\Response |
|
59 | + * @return null|Response |
|
60 | 60 | */ |
61 | 61 | public function login() |
62 | 62 | { |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | * |
310 | 310 | * @param int $blockedId user to ignore |
311 | 311 | * @param bool $set block or unblock |
312 | - * @return \Cake\Network\Response |
|
312 | + * @return Response|null |
|
313 | 313 | */ |
314 | 314 | protected function _ignore($blockedId, $set) |
315 | 315 | { |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | * View user profile. |
360 | 360 | * |
361 | 361 | * @param null $id user-ID |
362 | - * @return \Cake\Network\Response|void |
|
362 | + * @return null|Response |
|
363 | 363 | */ |
364 | 364 | public function view($id = null) |
365 | 365 | { |
@@ -420,8 +420,8 @@ discard block |
||
420 | 420 | /** |
421 | 421 | * Set user avatar. |
422 | 422 | * |
423 | - * @param string $userId user-ID |
|
424 | - * @return void|\Cake\Network\Response |
|
423 | + * @param integer $userId user-ID |
|
424 | + * @return Response|null |
|
425 | 425 | */ |
426 | 426 | public function avatar(int $userId) |
427 | 427 | { |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | * |
455 | 455 | * @param null $id user-ID |
456 | 456 | * |
457 | - * @return \Cake\Network\Response|void |
|
457 | + * @return Response|null |
|
458 | 458 | */ |
459 | 459 | public function edit($id = null) |
460 | 460 | { |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | /** |
662 | 662 | * Set slidetab-order. |
663 | 663 | * |
664 | - * @return \Cake\Network\Response |
|
664 | + * @return Response |
|
665 | 665 | * @throws BadRequestException |
666 | 666 | */ |
667 | 667 | public function slidetabOrder() |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | * Set category for user. |
710 | 710 | * |
711 | 711 | * @param null $id category-ID |
712 | - * @return \Cake\Network\Response |
|
712 | + * @return Response|null |
|
713 | 713 | * @throws ForbiddenException |
714 | 714 | */ |
715 | 715 | public function setcategory($id = null) |
@@ -10,7 +10,6 @@ |
||
10 | 10 | namespace App\Controller; |
11 | 11 | |
12 | 12 | use App\Controller\Component\RefererComponent; |
13 | -use App\Controller\Component\ThemesComponent; |
|
14 | 13 | use App\Form\BlockForm; |
15 | 14 | use App\Model\Entity\User; |
16 | 15 | use App\Model\Table\UsersTable; |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | } |
235 | 235 | $code = $this->request->getQuery('c'); |
236 | 236 | try { |
237 | - $activated = $this->Users->activate((int)$id, $code); |
|
237 | + $activated = $this->Users->activate((int) $id, $code); |
|
238 | 238 | } catch (\Exception $e) { |
239 | 239 | $activated = false; |
240 | 240 | } |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | public function ignore() |
293 | 293 | { |
294 | 294 | $this->request->allowMethod('POST'); |
295 | - $blockedId = (int)$this->request->getData('id'); |
|
295 | + $blockedId = (int) $this->request->getData('id'); |
|
296 | 296 | $this->_ignore($blockedId, true); |
297 | 297 | } |
298 | 298 | |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | public function unignore() |
305 | 305 | { |
306 | 306 | $this->request->allowMethod('POST'); |
307 | - $blockedId = (int)$this->request->getData('id'); |
|
307 | + $blockedId = (int) $this->request->getData('id'); |
|
308 | 308 | $this->_ignore($blockedId, false); |
309 | 309 | } |
310 | 310 | |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | protected function _ignore($blockedId, $set) |
319 | 319 | { |
320 | 320 | $userId = $this->CurrentUser->getId(); |
321 | - if ((int)$userId === (int)$blockedId) { |
|
321 | + if ((int) $userId === (int) $blockedId) { |
|
322 | 322 | throw new BadRequestException(); |
323 | 323 | } |
324 | 324 | if ($set) { |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | $user = $this->Users->find() |
380 | 380 | ->contain( |
381 | 381 | [ |
382 | - 'UserBlocks' => function ($q) { |
|
382 | + 'UserBlocks' => function($q) { |
|
383 | 383 | return $q->find('assocUsers'); |
384 | 384 | }, |
385 | 385 | 'UserOnline' |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | throw new BadRequestException; |
541 | 541 | } |
542 | 542 | |
543 | - $id = (int)$this->request->getData('lockUserId'); |
|
543 | + $id = (int) $this->request->getData('lockUserId'); |
|
544 | 544 | if (!$this->Users->exists($id)) { |
545 | 545 | throw new NotFoundException('User does not exist.', 1524298280); |
546 | 546 | } |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | $this->Flash->set($message, ['element' => 'error']); |
555 | 555 | } else { |
556 | 556 | try { |
557 | - $duration = (int)$this->request->getData('lockPeriod'); |
|
557 | + $duration = (int) $this->request->getData('lockPeriod'); |
|
558 | 558 | $blocker = new ManualBlocker($this->CurrentUser->getId(), $duration); |
559 | 559 | $status = $this->Users->UserBlocks->block($blocker, $id); |
560 | 560 | if (!$status) { |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | $allowed = $this->Slidetabs->getAvailable(); |
680 | 680 | $order = array_filter( |
681 | 681 | $order, |
682 | - function ($item) use ($allowed) { |
|
682 | + function($item) use ($allowed) { |
|
683 | 683 | return in_array($item, $allowed); |
684 | 684 | } |
685 | 685 | ); |
@@ -14,7 +14,7 @@ |
||
14 | 14 | * |
15 | 15 | * @param Event $event event |
16 | 16 | * @param Entity $entity entity |
17 | - * @param array|\ArrayObject $options options |
|
17 | + * @param \ArrayObject $options options |
|
18 | 18 | * - 'clearCache' set to 'false' to prevent cache clearing |
19 | 19 | * @return void |
20 | 20 | */ |
@@ -6,7 +6,6 @@ |
||
6 | 6 | use Cake\Database\Expression\QueryExpression; |
7 | 7 | use Cake\Event\Event; |
8 | 8 | use Cake\Event\EventManager; |
9 | -use Cake\ORM\Entity; |
|
10 | 9 | use Cake\ORM\Table; |
11 | 10 | use Saito\Event\SaitoEventManager; |
12 | 11 |
@@ -125,6 +125,7 @@ |
||
125 | 125 | |
126 | 126 | /** |
127 | 127 | * {@inheritdoc} |
128 | + * @param string $key |
|
128 | 129 | */ |
129 | 130 | public function getConfig($key = null, $default = null) |
130 | 131 | { |
@@ -129,7 +129,7 @@ |
||
129 | 129 | public function getConfig($key = null, $default = null) |
130 | 130 | { |
131 | 131 | if (is_string($key)) { |
132 | - $setting = Configure::read('Saito.Settings.' . $key); |
|
132 | + $setting = Configure::read('Saito.Settings.'.$key); |
|
133 | 133 | if ($setting !== null) { |
134 | 134 | return $setting; |
135 | 135 | } |
@@ -62,7 +62,7 @@ |
||
62 | 62 | /** |
63 | 63 | * attaches event-listener |
64 | 64 | * |
65 | - * @param string|SaitoEventListener $key key |
|
65 | + * @param \Saito\Cache\EntriesCacheSupportCachelet $key key |
|
66 | 66 | * @param null $callable function if $key is set |
67 | 67 | * @return void |
68 | 68 | * @throws InvalidArgumentException |
@@ -55,7 +55,7 @@ |
||
55 | 55 | { |
56 | 56 | $data = ($event->getData()) ?: []; |
57 | 57 | $data += ['subject' => $event->getSubject()]; |
58 | - $name = 'Event.Saito.' . $event->getName(); |
|
58 | + $name = 'Event.Saito.'.$event->getName(); |
|
59 | 59 | $this->dispatch($name, $data); |
60 | 60 | } |
61 | 61 |
@@ -43,7 +43,7 @@ |
||
43 | 43 | /** |
44 | 44 | * Checks if answering an entry is allowed |
45 | 45 | * |
46 | - * @return bool |
|
46 | + * @return string|boolean |
|
47 | 47 | */ |
48 | 48 | public function isAnsweringForbidden() |
49 | 49 | { |
@@ -167,7 +167,7 @@ |
||
167 | 167 | { |
168 | 168 | if (!$this->isRoot()) { |
169 | 169 | throw new \RuntimeException( |
170 | - 'Posting with id ' . $this->get('id') . ' is no root posting.' |
|
170 | + 'Posting with id '.$this->get('id').' is no root posting.' |
|
171 | 171 | ); |
172 | 172 | } |
173 | 173 | if (!$this->_CurrentUser->get('last_refresh')) { |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Saito\Posting\Basic\BasicPostingInterface; |
6 | 6 | use Saito\Posting\Basic\BasicPostingTrait; |
7 | -use Saito\Posting\Decorator\PostingTrait; |
|
8 | 7 | use Saito\Posting\Decorator\UserPostingTrait; |
9 | 8 | use Saito\Thread\Thread; |
10 | 9 | use Saito\User\CurrentUser\CurrentUser; |
@@ -102,7 +102,7 @@ |
||
102 | 102 | { |
103 | 103 | $postings = []; |
104 | 104 | $this->map( |
105 | - function ($node) use (&$postings) { |
|
105 | + function($node) use (&$postings) { |
|
106 | 106 | $postings[$node->get('id')] = $node; |
107 | 107 | }, |
108 | 108 | false |