@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Saito - The Threaded Web Forum |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | return $this->_mapFields( |
57 | 57 | $data, |
58 | 58 | $required, |
59 | - function (&$data, $field, $model = null) { |
|
59 | + function(&$data, $field, $model = null) { |
|
60 | 60 | if ($model === null) { |
61 | 61 | if (!isset($data[$field])) { |
62 | 62 | return false; |
@@ -68,11 +68,11 @@ |
||
68 | 68 | { |
69 | 69 | $parser = new ConsoleOptionParser('console'); |
70 | 70 | $parser->setDescription( |
71 | - 'This shell provides a REPL that you can use to interact ' . |
|
72 | - 'with your application in an interactive fashion. You can use ' . |
|
73 | - 'it to run adhoc queries with your models, or experiment ' . |
|
74 | - 'and explore the features of CakePHP and your application.' . |
|
75 | - "\n\n" . |
|
71 | + 'This shell provides a REPL that you can use to interact '. |
|
72 | + 'with your application in an interactive fashion. You can use '. |
|
73 | + 'it to run adhoc queries with your models, or experiment '. |
|
74 | + 'and explore the features of CakePHP and your application.'. |
|
75 | + "\n\n". |
|
76 | 76 | 'You will need to have psysh installed for this Shell to work.' |
77 | 77 | ); |
78 | 78 |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | public function generatePostings() |
113 | 113 | { |
114 | - $nPostings = (int)$this->in( |
|
114 | + $nPostings = (int) $this->in( |
|
115 | 115 | 'Number of postings to generate?', |
116 | 116 | null, |
117 | 117 | 100 |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | if ($nPostings === 0) { |
120 | 120 | return; |
121 | 121 | } |
122 | - $ratio = (int)$this->in('Average answers per thread?', null, 10); |
|
122 | + $ratio = (int) $this->in('Average answers per thread?', null, 10); |
|
123 | 123 | $seed = $nPostings / $ratio; |
124 | 124 | |
125 | 125 | $CurrentUser = new SaitoUserDummy(); |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $posting = $this->Entries->createPosting($posting); |
144 | 144 | if (empty($posting)) { |
145 | 145 | throw new \RuntimeException( |
146 | - 'Could not create entry: ' . $posting |
|
146 | + 'Could not create entry: '.$posting |
|
147 | 147 | ); |
148 | 148 | } |
149 | 149 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | public function generateUsers() |
161 | 161 | { |
162 | 162 | $max = count($this->_users); |
163 | - $n = (int)$this->in( |
|
163 | + $n = (int) $this->in( |
|
164 | 164 | "Number of users to generate (max: $max)?", |
165 | 165 | null, |
166 | 166 | 0 |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | } |
197 | 197 | $this->out('.', 0); |
198 | 198 | if ($i > 1 && !($i % 50)) { |
199 | - $percent = (int)floor($i / $off * 100); |
|
199 | + $percent = (int) floor($i / $off * 100); |
|
200 | 200 | $this->out(sprintf(' %3s%%', $percent), 1); |
201 | 201 | } |
202 | 202 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | { |
36 | 36 | $strlen = strlen($ip); |
37 | 37 | if ($strlen > 6) { |
38 | - $divider = (int)floor($strlen / 4) + 1; |
|
38 | + $divider = (int) floor($strlen / 4) + 1; |
|
39 | 39 | $ip = substr_replace($ip, '…', $divider, $strlen - (2 * $divider)); |
40 | 40 | } |
41 | 41 |
@@ -177,7 +177,7 @@ |
||
177 | 177 | */ |
178 | 178 | public function findAssocUsers(Query $query) |
179 | 179 | { |
180 | - $callback = function (Query $query) { |
|
180 | + $callback = function(Query $query) { |
|
181 | 181 | return $query->select(['id', 'username']); |
182 | 182 | }; |
183 | 183 | $query->contain(['By' => $callback, 'Users' => $callback]); |
@@ -81,7 +81,7 @@ |
||
81 | 81 | |
82 | 82 | return $this->rememberStatic( |
83 | 83 | $key, |
84 | - function () use ($key) { |
|
84 | + function() use ($key) { |
|
85 | 85 | return $this->find('all') |
86 | 86 | ->cache($key) |
87 | 87 | ->order(['category_order' => 'ASC']) |
@@ -63,7 +63,7 @@ |
||
63 | 63 | $entities = $this->newEntities($data); |
64 | 64 | // @performance is one transaction but multiple inserts |
65 | 65 | $this->getConnection()->transactional( |
66 | - function () use ($entities) { |
|
66 | + function() use ($entities) { |
|
67 | 67 | foreach ($entities as $entity) { |
68 | 68 | $this->save($entity, ['atomic' => false]); |
69 | 69 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | 'Users' => ['entry_count'], |
171 | 171 | // cache how many threads a category has |
172 | 172 | 'Categories' => [ |
173 | - 'thread_count' => function ($event, Entity $entity, $table, $original) { |
|
173 | + 'thread_count' => function($event, Entity $entity, $table, $original) { |
|
174 | 174 | if (!$entity->isRoot()) { |
175 | 175 | return false; |
176 | 176 | } |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | |
318 | 318 | $options['category_id'] = $User->Categories->getAll('read'); |
319 | 319 | |
320 | - $read = function () use ($options) { |
|
320 | + $read = function() use ($options) { |
|
321 | 321 | $conditions = []; |
322 | 322 | if ($options['user_id'] !== null) { |
323 | 323 | $conditions[]['Entries.user_id'] = $options['user_id']; |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | return $result; |
345 | 345 | }; |
346 | 346 | |
347 | - $key = 'Entry.recentEntries-' . md5(serialize($options)); |
|
347 | + $key = 'Entry.recentEntries-'.md5(serialize($options)); |
|
348 | 348 | $results = Cache::remember($key, $read, 'entries'); |
349 | 349 | |
350 | 350 | $threads = []; |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | )->first(); |
376 | 376 | if (empty($entry)) { |
377 | 377 | throw new \UnexpectedValueException( |
378 | - 'Posting not found. Posting-Id: ' . $id |
|
378 | + 'Posting not found. Posting-Id: '.$id |
|
379 | 379 | ); |
380 | 380 | } |
381 | 381 | |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | unset($options['return']); |
397 | 397 | |
398 | 398 | $result = $this->find('entry') |
399 | - ->where([$this->getAlias() . '.id' => $primaryKey]) |
|
399 | + ->where([$this->getAlias().'.id' => $primaryKey]) |
|
400 | 400 | ->first(); |
401 | 401 | |
402 | 402 | if (!$result) { |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | $entry = $this->find()->select('pid')->where(['id' => $id])->first(); |
425 | 425 | if (!$entry) { |
426 | 426 | throw new \UnexpectedValueException( |
427 | - 'Posting not found. Posting-Id: ' . $id |
|
427 | + 'Posting not found. Posting-Id: '.$id |
|
428 | 428 | ); |
429 | 429 | } |
430 | 430 | |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | $tree = reset($tree); |
618 | 618 | |
619 | 619 | //= extract subtree |
620 | - if ((int)$tid !== (int)$id) { |
|
620 | + if ((int) $tid !== (int) $id) { |
|
621 | 621 | $tree = $tree->getThread()->get($id); |
622 | 622 | } |
623 | 623 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Saito - The Threaded Web Forum |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | { |
85 | 85 | Stopwatch::start('Settings->getSettings()'); |
86 | 86 | |
87 | - $cacheKey = 'Saito.appSettings.' . Configure::read('Saito.v'); |
|
87 | + $cacheKey = 'Saito.appSettings.'.Configure::read('Saito.v'); |
|
88 | 88 | |
89 | 89 | $settings = Cache::remember( |
90 | 90 | $cacheKey, |
91 | - function () { |
|
91 | + function() { |
|
92 | 92 | return $this->getSettings(); |
93 | 93 | } |
94 | 94 | ); |