Passed
Push — master ( ef4849...3d6fe1 )
by Mihail
05:23
created
Apps/Model/Front/Content/EntityCategoryList.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     {
60 60
         $this->_path = $path;
61 61
         $this->_configs = $configs;
62
-        $this->_page = (int)$offset;
62
+        $this->_page = (int) $offset;
63 63
         $this->_sort = $sort;
64 64
         parent::__construct();
65 65
     }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     public function before()
73 73
     {
74 74
         // find one or more categories where we must looking for content items
75
-        if ((int)$this->_configs['multiCategories'] === 1) {
75
+        if ((int) $this->_configs['multiCategories'] === 1) {
76 76
             $this->findCategories();
77 77
         } else {
78 78
             $this->findCategory();
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      */
92 92
     public function setItemLimit($limit)
93 93
     {
94
-        $this->_customItemLimit = (int)$limit;
94
+        $this->_customItemLimit = (int) $limit;
95 95
     }
96 96
 
97 97
     /**
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
     private function findCategories()
120 120
     {
121 121
         // get all categories for current path and child of it
122
-        $query = ContentCategory::where('path', 'like', $this->_path . '%');
122
+        $query = ContentCategory::where('path', 'like', $this->_path.'%');
123 123
         if ($query->count() < 1) {
124 124
             throw new NotFoundException(__('Category is not founded'));
125 125
         }
@@ -152,10 +152,10 @@  discard block
 block discarded – undo
152 152
         }
153 153
 
154 154
         // calculate selection offset
155
-        $itemPerPage = (int)$this->_configs['itemPerCategory'];
155
+        $itemPerPage = (int) $this->_configs['itemPerCategory'];
156 156
         // check if custom itemlimit defined over model api
157 157
         if ($this->_customItemLimit !== false) {
158
-            $itemPerPage = (int)$this->_customItemLimit;
158
+            $itemPerPage = (int) $this->_customItemLimit;
159 159
         }
160 160
 
161 161
         $offset = $this->_page * $itemPerPage;
@@ -197,15 +197,15 @@  discard block
 block discarded – undo
197 197
         $catConfigs = Serialize::decode($this->_currentCategory->configs);
198 198
         // prepare rss url link for current category if enabled
199 199
         $rssUrl = false;
200
-        if ((int)$this->_configs['rss'] === 1 && (int)$catConfigs['showRss'] === 1) {
201
-            $rssUrl = App::$Alias->baseUrl . '/content/rss/' . $this->_currentCategory->path;
200
+        if ((int) $this->_configs['rss'] === 1 && (int) $catConfigs['showRss'] === 1) {
201
+            $rssUrl = App::$Alias->baseUrl.'/content/rss/'.$this->_currentCategory->path;
202 202
             $rssUrl = rtrim($rssUrl, '/');
203 203
         }
204 204
 
205 205
         // prepare sorting urls
206 206
         $catSortParams = [];
207 207
         if (App::$Request->query->get('page') !== null) {
208
-            $catSortParams['page'] = (int)App::$Request->query->get('page');
208
+            $catSortParams['page'] = (int) App::$Request->query->get('page');
209 209
         }
210 210
         $catSortUrls = [
211 211
             'views' => Url::to('content/list', $this->_currentCategory->path, null, Arr::merge($catSortParams, ['sort' => 'views']), false),
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
         ];
225 225
 
226 226
         // check if this category is hidden
227
-        if ((int)$this->category['configs']['showCategory'] !== 1) {
227
+        if ((int) $this->category['configs']['showCategory'] !== 1) {
228 228
             throw new ForbiddenException(__('This category is not available to view'));
229 229
         }
230 230
 
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
             // check if current user can rate item
280 280
             $ignoredRate = App::$Session->get('content.rate.ignore');
281 281
             $canRate = true;
282
-            if (Obj::isArray($ignoredRate) && Arr::in((string)$row->id, $ignoredRate)) {
282
+            if (Obj::isArray($ignoredRate) && Arr::in((string) $row->id, $ignoredRate)) {
283 283
                 $canRate = false;
284 284
             }
285 285
             if (!App::$User->isAuth()) {
@@ -299,11 +299,11 @@  discard block
 block discarded – undo
299 299
                 'poster' => $row->getPosterUri(),
300 300
                 'thumb' => $row->getPosterThumbUri(),
301 301
                 'thumbSize' => File::size($row->getPosterThumbUri()),
302
-                'views' => (int)$row->views,
303
-                'rating' => (int)$row->rating,
302
+                'views' => (int) $row->views,
303
+                'rating' => (int) $row->rating,
304 304
                 'canRate' => $canRate,
305 305
                 'category' => $this->categories[$row->category_id],
306
-                'uri' => '/content/read/' . $itemPath,
306
+                'uri' => '/content/read/'.$itemPath,
307 307
                 'tags' => $tags
308 308
             ];
309 309
         }
Please login to merge, or discard this patch.
Apps/Model/Front/Sitemap/EntityIndexList.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,10 +47,10 @@  discard block
 block discarded – undo
47 47
         $scan = File::listFiles(static::INDEX_PATH, ['.xml'], true);
48 48
         if (Obj::isArray($scan)) {
49 49
             foreach ($scan as $file) {
50
-                if (!Str::contains('.' . $this->_lang, $file)) {
50
+                if (!Str::contains('.'.$this->_lang, $file)) {
51 51
                     continue;
52 52
                 }
53
-                $this->files[] = static::INDEX_PATH . '/' . $file;
53
+                $this->files[] = static::INDEX_PATH.'/'.$file;
54 54
             }
55 55
         }
56 56
     }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         // build file information data
68 68
         foreach ($this->files as $file) {
69 69
             $this->info[] = [
70
-                'loc' => App::$Alias->scriptUrl . $file,
70
+                'loc' => App::$Alias->scriptUrl.$file,
71 71
                 'lastmod' => Date::convertToDatetime(File::mTime($file), 'c')
72 72
             ];
73 73
         }
Please login to merge, or discard this patch.
Apps/Model/Front/Sitemap/EntityBuildMap.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -52,16 +52,16 @@  discard block
 block discarded – undo
52 52
                 $this->data[$lang][] = [
53 53
                     'uri' => Url::standaloneUrl($uri, $lang),
54 54
                     'lastmod' => Date::convertToDatetime($lastmod, 'c'),
55
-                    'freq' => (string)$freq,
56
-                    'priority' => (float)$priority
55
+                    'freq' => (string) $freq,
56
+                    'priority' => (float) $priority
57 57
                 ];
58 58
             }
59 59
         } else { // only one language, multilanguage is disabled
60 60
             $this->data[App::$Properties->get('singleLanguage')][] = [
61 61
                 'uri' => Url::standaloneUrl($uri),
62 62
                 'lastmod' => Date::convertToDatetime($lastmod, 'c'),
63
-                'freq' => (string)$freq,
64
-                'priority' => (float)$priority
63
+                'freq' => (string) $freq,
64
+                'priority' => (float) $priority
65 65
             ];
66 66
         }
67 67
     }
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
                 'items' => $items
87 87
             ]);
88 88
             
89
-            File::write(EntityIndexList::INDEX_PATH . '/' . $uniqueName . '.' . $lang . '.xml', $xml);
89
+            File::write(EntityIndexList::INDEX_PATH.'/'.$uniqueName.'.'.$lang.'.xml', $xml);
90 90
         }
91 91
         return true;
92 92
     }
Please login to merge, or discard this patch.
Apps/Controller/Front/Content.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
     {
56 56
         $path = App::$Request->getPathWithoutControllerAction();
57 57
         $configs = $this->getConfigs();
58
-        $page = (int)App::$Request->query->get('page', 0);
59
-        $sort = (string)App::$Request->query->get('sort', 'newest');
60
-        $itemCount = (int)$configs['itemPerCategory'];
58
+        $page = (int) App::$Request->query->get('page', 0);
59
+        $sort = (string) App::$Request->query->get('sort', 'newest');
60
+        $itemCount = (int) $configs['itemPerCategory'];
61 61
 
62 62
         // build special model with content list and category list information
63 63
         $model = new EntityCategoryList($path, $configs, $page, $sort);
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
         $model = new EntityContentRead($categoryRecord, $contentRecord->first());
138 138
         $search = null;
139 139
         // check if similar search is enabled for item category
140
-        if ((int)$model->getCategory()->getProperty('showSimilar') === 1 && $trash === false) {
140
+        if ((int) $model->getCategory()->getProperty('showSimilar') === 1 && $trash === false) {
141 141
             $search = new EntityContentSearch($model->title, $model->id);
142 142
         }
143 143
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
     {
168 168
         $configs = $this->getConfigs();
169 169
         // check if tags is enabled
170
-        if ((int)$configs['keywordsAsTags'] !== 1) {
170
+        if ((int) $configs['keywordsAsTags'] !== 1) {
171 171
             throw new NotFoundException(__('Tag system is disabled'));
172 172
         }
173 173
 
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
         }
181 181
 
182 182
         // get equal rows order by creation date
183
-        $records = ContentEntity::where('meta_keywords', 'like', '%' . $tagName . '%')->orderBy('created_at', 'DESC')->take(self::TAG_PER_PAGE);
183
+        $records = ContentEntity::where('meta_keywords', 'like', '%'.$tagName.'%')->orderBy('created_at', 'DESC')->take(self::TAG_PER_PAGE);
184 184
         // check if result is not empty
185 185
         if ($records->count() < 1) {
186 186
             throw new NotFoundException(__('Nothing founded'));
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
         $this->layout = null;
215 215
 
216 216
         // check if rss display allowed for this category
217
-        if ((int)$model->category['configs']['showRss'] !== 1) {
217
+        if ((int) $model->category['configs']['showRss'] !== 1) {
218 218
             throw new ForbiddenException(__('Rss feed is disabled for this category'));
219 219
         }
220 220
 
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         // set channel data
226 226
         $channel->title($model->category['title'])
227 227
             ->description($model->category['description'])
228
-            ->url(App::$Alias->baseUrl . '/content/list/' . $model->category['path'])
228
+            ->url(App::$Alias->baseUrl.'/content/list/'.$model->category['path'])
229 229
             ->appendTo($feed);
230 230
 
231 231
         // add content data
@@ -235,10 +235,10 @@  discard block
 block discarded – undo
235 235
                 // add title, short text, url
236 236
                 $item->title($row['title'])
237 237
                     ->description($row['text'])
238
-                    ->url(App::$Alias->baseUrl . $row['uri']);
238
+                    ->url(App::$Alias->baseUrl.$row['uri']);
239 239
                 // add poster
240 240
                 if ($row['thumb'] !== null) {
241
-                    $item->enclosure(App::$Alias->scriptUrl . $row['thumb'], $row['thumbSize'], 'image/jpeg');
241
+                    $item->enclosure(App::$Alias->scriptUrl.$row['thumb'], $row['thumbSize'], 'image/jpeg');
242 242
                 }
243 243
 
244 244
                 // append response to channel
@@ -273,12 +273,12 @@  discard block
 block discarded – undo
273 273
 
274 274
         // check if user add enabled
275 275
         $configs = $this->getConfigs();
276
-        if (!(bool)$configs['userAdd']) {
276
+        if (!(bool) $configs['userAdd']) {
277 277
             throw new NotFoundException(__('User add is disabled'));
278 278
         }
279 279
 
280 280
         // prepare query
281
-        $page = (int)App::$Request->query->get('page', 0);
281
+        $page = (int) App::$Request->query->get('page', 0);
282 282
         $offset = $page * 10;
283 283
         $query = ContentRecord::where('author_id', '=', App::$User->identity()->getId());
284 284
 
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 
319 319
         // check if user add enabled
320 320
         $configs = $this->getConfigs();
321
-        if (!(bool)$configs['userAdd']) {
321
+        if (!(bool) $configs['userAdd']) {
322 322
             throw new NotFoundException(__('User add is disabled'));
323 323
         }
324 324
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
         $new = $record->id === null;
328 328
 
329 329
         // reject edit published items and items from other authors
330
-        if (($new === false && (int)$record->author_id !== App::$User->identity()->getId()) || (int)$record->display === 1) {
330
+        if (($new === false && (int) $record->author_id !== App::$User->identity()->getId()) || (int) $record->display === 1) {
331 331
             throw new ForbiddenException(__('You have no permissions to edit this content'));
332 332
         }
333 333
 
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
             $category = $content->getCategory();
377 377
             $uri = '/content/read/';
378 378
             if (!Str::likeEmpty($category->path)) {
379
-                $uri .= $category->path . '/';
379
+                $uri .= $category->path.'/';
380 380
             }
381 381
             $uri .= $content->path;
382 382
             $sitemap->add($uri, $content->created_at, 'weekly', 0.7);
@@ -384,8 +384,8 @@  discard block
 block discarded – undo
384 384
         // add categories
385 385
         $categories = ContentCategory::getAll();
386 386
         foreach ($categories as $item) {
387
-            if ((bool)$item->getProperty('showCategory')) {
388
-                $uri = '/content/list/' . $item->path;
387
+            if ((bool) $item->getProperty('showCategory')) {
388
+                $uri = '/content/list/'.$item->path;
389 389
                 $sitemap->add($uri, date('c'), 'daily', 0.9);
390 390
             }
391 391
         }
Please login to merge, or discard this patch.