Passed
Push — master ( b534e3...17b30a )
by Mihail
19:51
created
Apps/Controller/Api/Profile.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
             $answerTime = Date::convertToTimestamp($lastAnswer->created_at);
175 175
             $cfgs = \Apps\ActiveRecord\App::getConfigs('app', 'Profile');
176 176
             // hmm, maybe past less then delay required?
177
-            if ($now - (int)$cfgs['delayBetweenPost'] < $answerTime) {
177
+            if ($now - (int) $cfgs['delayBetweenPost'] < $answerTime) {
178 178
                 throw new ForbiddenException('Delay between answers not pass');
179 179
             }
180 180
         }
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
         // add notification for target user
190 190
         if ($viewer->id !== $target_id) {
191 191
             $notify = new EntityAddNotification($target_id);
192
-            $notify->add('/profile/show/' . $target_id . '#wall-post-' . $wallRow->id, EntityAddNotification::MSG_ADD_WALLANSWER, [
192
+            $notify->add('/profile/show/'.$target_id.'#wall-post-'.$wallRow->id, EntityAddNotification::MSG_ADD_WALLANSWER, [
193 193
                 'snippet' => Text::snippet($message, 50),
194 194
                 'post' => $wallRow->message
195 195
             ]);
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
             // sender is not myself? then i'm - target (remote user is sender user->to_me)
299 299
             if ($row->sender_id !== $user->id) {
300 300
                 $userList[] = $row->sender_id;
301
-                if ((bool)$row->readed !== true) {
301
+                if ((bool) $row->readed !== true) {
302 302
                     $unreadList[] = $row->sender_id;
303 303
                 }
304 304
             }
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 
380 380
         // get special types for this action
381 381
         $queryType = $this->request->get('type');
382
-        $queryId = (int)$this->request->get('id');
382
+        $queryId = (int) $this->request->get('id');
383 383
         // get current user object
384 384
         $user = App::$User->identity();
385 385
 
@@ -395,11 +395,11 @@  discard block
 block discarded – undo
395 395
         switch ($queryType) {
396 396
             case 'after':
397 397
                 $messages = Message::where('id', '>', $queryId)
398
-                    ->where(function ($query) use ($cor_id, $user) {
399
-                        $query->where(function ($q) use ($cor_id, $user) {
398
+                    ->where(function($query) use ($cor_id, $user) {
399
+                        $query->where(function($q) use ($cor_id, $user) {
400 400
                             $q->where('target_id', '=', $user->getId())
401 401
                                 ->where('sender_id', '=', $cor_id);
402
-                        })->orWhere(function ($q) use ($cor_id, $user) {
402
+                        })->orWhere(function($q) use ($cor_id, $user) {
403 403
                             $q->where('target_id', '=', $cor_id)
404 404
                                 ->where('sender_id', '=', $user->getId());
405 405
                         });
@@ -407,21 +407,21 @@  discard block
 block discarded – undo
407 407
                 break;
408 408
             case 'before':
409 409
                 $messages = Message::where('id', '<', $queryId)
410
-                    ->where(function ($query) use ($cor_id, $user) {
411
-                        $query->where(function ($q) use ($cor_id, $user) {
410
+                    ->where(function($query) use ($cor_id, $user) {
411
+                        $query->where(function($q) use ($cor_id, $user) {
412 412
                             $q->where('target_id', '=', $user->getId())
413 413
                                 ->where('sender_id', '=', $cor_id);
414
-                        })->orWhere(function ($q) use ($cor_id, $user) {
414
+                        })->orWhere(function($q) use ($cor_id, $user) {
415 415
                             $q->where('target_id', '=', $cor_id)
416 416
                                 ->where('sender_id', '=', $user->getId());
417 417
                         });
418 418
                     });
419 419
                 break;
420 420
             default:
421
-                $messages = Message::where(function ($query) use ($cor_id, $user) {
421
+                $messages = Message::where(function($query) use ($cor_id, $user) {
422 422
                     $query->where('target_id', '=', $user->getId())
423 423
                         ->where('sender_id', '=', $cor_id);
424
-                })->orWhere(function ($query) use ($cor_id, $user) {
424
+                })->orWhere(function($query) use ($cor_id, $user) {
425 425
                     $query->where('target_id', '=', $cor_id)
426 426
                         ->where('sender_id', '=', $user->getId());
427 427
                 });
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
             ];
453 453
 
454 454
             // update status to readed
455
-            if ((bool)$msg->readed !== true && $msg->sender_id !== $user->id) {
455
+            if ((bool) $msg->readed !== true && $msg->sender_id !== $user->id) {
456 456
                 $msg->readed = true;
457 457
                 $msg->save();
458 458
             }
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
         $this->setJsonHeader();
521 521
 
522 522
         // get operation type and target user id
523
-        $targetId = (int)$this->request->get('target');
523
+        $targetId = (int) $this->request->get('target');
524 524
         $type = $this->request->get('type');
525 525
 
526 526
         // check type of query
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 
536 536
         $cfg = \Apps\ActiveRecord\App::getConfigs('app', 'Profile');
537 537
         // check if rating is enabled for website
538
-        if (!(bool)$cfg['rating']) {
538
+        if (!(bool) $cfg['rating']) {
539 539
             throw new NativeException('Rating is disabled');
540 540
         }
541 541
 
Please login to merge, or discard this patch.
Apps/Controller/Api/Comments.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         $this->setJsonHeader();
34 34
         $configs = AppRecord::getConfigs('widget', 'Comments');
35 35
 
36
-        $replayTo = (int)$this->request->request->get('replay-to');
36
+        $replayTo = (int) $this->request->request->get('replay-to');
37 37
         $model = null;
38 38
         // check if its a answer (comment answer type)
39 39
         if ($replayTo > 0) {
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         }
46 46
 
47 47
         // pass general comment params to model
48
-        $model->message = App::$Security->secureHtml((string)$this->request->request->get('message'));
48
+        $model->message = App::$Security->secureHtml((string) $this->request->request->get('message'));
49 49
         $model->guestName = App::$Security->strip_tags($this->request->request->get('guest-name'));
50 50
 
51 51
         // check model conditions before add new row
@@ -77,12 +77,12 @@  discard block
 block discarded – undo
77 77
         // get configs
78 78
         $configs = AppRecord::getConfigs('widget', 'Comments');
79 79
         // items per page
80
-        $perPage = (int)$configs['perPage'];
80
+        $perPage = (int) $configs['perPage'];
81 81
         // offset can be only integer
82
-        $index = (int)$index;
82
+        $index = (int) $index;
83 83
         $offset = $perPage * $index;
84 84
         // get comment target path and check
85
-        $path = (string)$this->request->query->get('path');
85
+        $path = (string) $this->request->query->get('path');
86 86
         if (Str::likeEmpty($path)) {
87 87
             throw new NotFoundException('Wrong path');
88 88
         }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
             ->where('moderate', '=', 0);
93 93
 
94 94
         // check if comments is depend of language locale
95
-        if ((bool)$configs['onlyLocale'] === true) {
95
+        if ((bool) $configs['onlyLocale'] === true) {
96 96
             $query = $query->where('lang', '=', $this->request->getLanguage());
97 97
         }
98 98
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         // calculate comments left count
122 122
         $countQuery = CommentPost::where('pathway', '=', $path)->where('moderate', '=', 0);
123 123
         // check if comments is depend of language locale
124
-        if ((bool)$configs['onlyLocale'] === true) {
124
+        if ((bool) $configs['onlyLocale'] === true) {
125 125
             $countQuery = $countQuery->where('lang', '=', $this->request->getLanguage());
126 126
         }
127 127
         $count = $countQuery->count();
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
         $records = CommentAnswer::with(['user', 'user.profile', 'user.role'])
161 161
             ->where('comment_id', '=', $commentId)
162 162
             ->where('moderate', '=', 0);
163
-        if ((int)$configs['onlyLocale'] === 1) {
163
+        if ((int) $configs['onlyLocale'] === 1) {
164 164
             $records = $records->where('lang', '=', $this->request->getLanguage());
165 165
         }
166 166
 
@@ -205,11 +205,11 @@  discard block
 block discarded – undo
205 205
         foreach ($path as $id => $uri) {
206 206
             $query = CommentPost::where('pathway', '=', $uri)->where('moderate', '=', 0);
207 207
             // check if comments is depend of language locale
208
-            if ((int)$configs['onlyLocale'] === 1) {
208
+            if ((int) $configs['onlyLocale'] === 1) {
209 209
                 $query = $query->where('lang', '=', $this->request->getLanguage());
210 210
             }
211 211
             // set itemId => count
212
-            $count[(int)$id] = $query->count();
212
+            $count[(int) $id] = $query->count();
213 213
         }
214 214
         // render json response
215 215
         return json_encode(['status' => 1, 'count' => $count]);
Please login to merge, or discard this patch.
Apps/Controller/Front/Main.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,6 +20,6 @@
 block discarded – undo
20 20
 
21 21
     public function actionRead($id)
22 22
     {
23
-        echo "Action read called" . $id;
23
+        echo "Action read called".$id;
24 24
     }
25 25
 }
Please login to merge, or discard this patch.
Apps/Controller/Front/Search.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,14 +28,14 @@
 block discarded – undo
28 28
     public function actionIndex()
29 29
     {
30 30
         // get search query value from GET headers
31
-        $query = (string)$this->request->query->get('query', null);
31
+        $query = (string) $this->request->query->get('query', null);
32 32
         // strip html tags
33 33
         $query = App::$Security->strip_tags(trim($query));
34 34
         // get configs
35 35
         $configs = $this->getConfigs();
36 36
 
37 37
         // check search query length
38
-        if (Str::likeEmpty($query) || Str::length($query) < (int)$configs['minLength']) {
38
+        if (Str::likeEmpty($query) || Str::length($query) < (int) $configs['minLength']) {
39 39
             throw new NotFoundException(__('Search query is too short!'));
40 40
         }
41 41
 
Please login to merge, or discard this patch.
Apps/Controller/Front/Feedback.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -42,18 +42,18 @@  discard block
 block discarded – undo
42 42
     {
43 43
         // get configs
44 44
         $configs = $this->getConfigs();
45
-        if (!App::$User->isAuth() && !(bool)$configs['guestAdd']) {
45
+        if (!App::$User->isAuth() && !(bool) $configs['guestAdd']) {
46 46
             throw new ForbiddenException(__('Feedback available only for authorized users'));
47 47
         }
48 48
 
49 49
         // initialize model
50
-        $model = new FormFeedbackAdd((int)$configs['useCaptcha'] === 1);
50
+        $model = new FormFeedbackAdd((int) $configs['useCaptcha'] === 1);
51 51
         if ($model->send()) {
52 52
             if ($model->validate()) {
53 53
                 // if validation is passed save data to db and get row
54 54
                 $record = $model->make();
55 55
                 App::$Session->getFlashBag()->add('success', __('Your message was added successful'));
56
-                $this->response->redirect('feedback/read/' . $record->id . '/' . $record->hash);
56
+                $this->response->redirect('feedback/read/'.$record->id.'/'.$record->hash);
57 57
             } else {
58 58
                 App::$Session->getFlashBag()->add('error', __('Message is not sended! Please, fix issues in form below'));
59 59
             }
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         // render output view
63 63
         return $this->view->render('create', [
64 64
             'model' => $model,
65
-            'useCaptcha' => (int)$configs['useCaptcha'] === 1
65
+            'useCaptcha' => (int) $configs['useCaptcha'] === 1
66 66
         ]);
67 67
     }
68 68
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         $userId = App::$User->isAuth() ? App::$User->identity()->getId() : 0;
95 95
         $model = null;
96 96
         // check if feedback post is not closed for answers
97
-        if (!(bool)$recordPost->closed) {
97
+        if (!(bool) $recordPost->closed) {
98 98
             // init new answer add model
99 99
             $model = new FormAnswerAdd($recordPost, $userId);
100 100
             // if answer is sender lets try to make it model
@@ -138,10 +138,10 @@  discard block
 block discarded – undo
138 138
         // check if action is submited
139 139
         if ($this->request->request->get('closeRequest', false)) {
140 140
             // if created by authorized user
141
-            if ((int)$record->user_id !== 0) {
141
+            if ((int) $record->user_id !== 0) {
142 142
                 $user = App::$User->identity();
143 143
                 // button is pressed not by request creator
144
-                if ($user === null || $user->getId() !== (int)$record->user_id) {
144
+                if ($user === null || $user->getId() !== (int) $record->user_id) {
145 145
                     throw new ForbiddenException(__('This feedback request was created by another user'));
146 146
                 }
147 147
             }
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 
153 153
             // add notification and redirect
154 154
             App::$Session->getFlashBag()->add('warning', __('Feedback request now is closed!'));
155
-            $this->response->redirect('feedback/read/' . $id . '/' . $hash);
155
+            $this->response->redirect('feedback/read/'.$id.'/'.$hash);
156 156
         }
157 157
 
158 158
         return $this->view->render('close');
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     public function actionList()
169 169
     {
170 170
         // set current page and offset
171
-        $page = (int)$this->request->query->get('page');
171
+        $page = (int) $this->request->query->get('page');
172 172
         $offset = $page * self::ITEM_PER_PAGE;
173 173
 
174 174
         // check if user is authorized or throw exception
Please login to merge, or discard this patch.
Apps/Controller/Admin/Main.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         $rootSize = App::$Cache->getItem('root.size');
48 48
         $loadAvg = App::$Cache->getItem('load.avarage');
49 49
         if (!$rootSize->isHit()) {
50
-            $calcSize = round(Directory::size('/') / (1024*1000), 2) . ' mb';
50
+            $calcSize = round(Directory::size('/') / (1024 * 1000), 2).' mb';
51 51
             $rootSize->set($calcSize);
52 52
             $rootSize->expiresAfter(86400);
53 53
             App::$Cache->save($rootSize);
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
 
61 61
         // prepare system statistic
62 62
         $stats = [
63
-            'ff_version' => Version::VERSION . ' (' . Version::DATE . ')',
64
-            'php_version' => Environment::phpVersion() . ' (' . Environment::phpSAPI() . ')',
63
+            'ff_version' => Version::VERSION.' ('.Version::DATE.')',
64
+            'php_version' => Environment::phpVersion().' ('.Environment::phpSAPI().')',
65 65
             'os_name' => Environment::osName(),
66
-            'database_name' => App::$Database->connection()->getDatabaseName() . ' (' . App::$Database->connection()->getDriverName() . ')',
66
+            'database_name' => App::$Database->connection()->getDatabaseName().' ('.App::$Database->connection()->getDriverName().')',
67 67
             'file_size' => $rootSize->get(),
68 68
             'load_avg' => $loadAvg->get()
69 69
         ];
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     public function actionFiles()
114 114
     {
115 115
         return $this->view->render('files', [
116
-            'connector' => App::$Alias->scriptUrl . '/api/main/files?lang=' . $this->request->getLanguage()
116
+            'connector' => App::$Alias->scriptUrl.'/api/main/files?lang='.$this->request->getLanguage()
117 117
         ]);
118 118
     }
119 119
 
@@ -182,9 +182,9 @@  discard block
 block discarded – undo
182 182
      */
183 183
     public function actionDeleteroute()
184 184
     {
185
-        $type = (string)$this->request->query->get('type');
186
-        $loader = (string)$this->request->query->get('loader');
187
-        $source = Str::lowerCase((string)$this->request->query->get('path'));
185
+        $type = (string) $this->request->query->get('type');
186
+        $loader = (string) $this->request->query->get('loader');
187
+        $source = Str::lowerCase((string) $this->request->query->get('path'));
188 188
 
189 189
         $model = new EntityDeleteRoute($type, $loader, $source);
190 190
         if ($model->send() && $model->validate()) {
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
     {
207 207
         $stats = App::$Cache->stats();
208 208
         // get size in mb from cache stats
209
-        $size = round((int)$stats['size'] / (1024*1024), 2);
209
+        $size = round((int) $stats['size'] / (1024 * 1024), 2);
210 210
 
211 211
         // check if submited
212 212
         if ($this->request->request->get('clearcache', false)) {
Please login to merge, or discard this patch.
Apps/Controller/Admin/Content.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     public function actionIndex()
44 44
     {
45 45
         // set current page and offset
46
-        $page = (int)$this->request->query->get('page');
46
+        $page = (int) $this->request->query->get('page');
47 47
         $offset = $page * self::ITEM_PER_PAGE;
48 48
 
49 49
         $query = null;
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
         } elseif ($type === 'moderate') { // only items on moderate
55 55
             $query = ContentEntity::where('display', '=', 0);
56 56
         } elseif (Any::isInt($type)) { // sounds like category id ;)
57
-            $query = ContentEntity::where('category_id', '=', (int)$type);
57
+            $query = ContentEntity::where('category_id', '=', (int) $type);
58 58
         } else {
59 59
             $query = new ContentEntity();
60 60
             $type = 'all';
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
     public function actionCategoryupdate($id = null)
265 265
     {
266 266
         // get owner id for new rows
267
-        $parentId = (int)$this->request->query->get('parent');
267
+        $parentId = (int) $this->request->query->get('parent');
268 268
 
269 269
         // get relation and pass to model
270 270
         $record = ContentCategory::findOrNew($id);
Please login to merge, or discard this patch.
Apps/Controller/Admin/Profile.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
         $query = ProfileRecords::with(['user']);
39 39
 
40 40
         // set current page and offset
41
-        $page = (int)$this->request->query->get('page');
41
+        $page = (int) $this->request->query->get('page');
42 42
         $offset = $page * self::ITEM_PER_PAGE;
43 43
 
44 44
         // build pagination
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      */
69 69
     public function actionDelete($id)
70 70
     {
71
-        $this->response->redirect('user/delete/' . $id);
71
+        $this->response->redirect('user/delete/'.$id);
72 72
     }
73 73
 
74 74
     /**
Please login to merge, or discard this patch.
Apps/Controller/Admin/Application.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
         $search = \Apps\ActiveRecord\App::getItem('app', $controller);
88 88
 
89 89
         // check what we got
90
-        if ($search === null || (int)$search->id < 1) {
90
+        if ($search === null || (int) $search->id < 1) {
91 91
             throw new NotFoundException('App is not founded');
92 92
         }
93 93
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
         $search = \Apps\ActiveRecord\App::where('sys_name', '=', $controllerName)->where('type', '=', 'app')->first();
121 121
 
122
-        if ($search === null || (int)$search->id < 1) {
122
+        if ($search === null || (int) $search->id < 1) {
123 123
             throw new ForbiddenException('App is not founded');
124 124
         }
125 125
 
Please login to merge, or discard this patch.