Passed
Push — master ( 347935...cc7747 )
by Mihail
05:42
created
Apps/Controller/Admin/Profile.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         $query = new ProfileRecords();
34 34
 
35 35
         // set current page and offset
36
-        $page = (int)$this->request->query->get('page');
36
+        $page = (int) $this->request->query->get('page');
37 37
         $offset = $page * self::ITEM_PER_PAGE;
38 38
 
39 39
         // build pagination
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      */
61 61
     public function actionDelete($id)
62 62
     {
63
-        $this->response->redirect('user/delete/' . $id);
63
+        $this->response->redirect('user/delete/'.$id);
64 64
     }
65 65
 
66 66
     /**
Please login to merge, or discard this patch.
Apps/Controller/Admin/Main.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -37,21 +37,21 @@  discard block
 block discarded – undo
37 37
         // cache some data
38 38
         $rootSize = App::$Cache->get('root.size');
39 39
         if ($rootSize === null) {
40
-            $rootSize = round(Directory::getSize('/') / (1024*1000), 2) . ' mb';
40
+            $rootSize = round(Directory::getSize('/') / (1024 * 1000), 2).' mb';
41 41
             App::$Cache->set('root.size', $rootSize, 86400); // 24 hours caching = 60 * 60 * 24
42 42
         }
43 43
         $loadAvg = App::$Cache->get('load.average');
44 44
         if ($loadAvg === null) {
45 45
             $loadAvg = Environment::loadAverage();
46
-            App::$Cache->set('load.average', $loadAvg, 60*5); // 5 min cache
46
+            App::$Cache->set('load.average', $loadAvg, 60 * 5); // 5 min cache
47 47
         }
48 48
 
49 49
         // prepare system statistic
50 50
         $stats = [
51
-            'ff_version' => App::$Properties->version['num'] . ' (' . App::$Properties->version['date'] . ')',
52
-            'php_version' => Environment::phpVersion() . ' (' . Environment::phpSAPI() . ')',
51
+            'ff_version' => App::$Properties->version['num'].' ('.App::$Properties->version['date'].')',
52
+            'php_version' => Environment::phpVersion().' ('.Environment::phpSAPI().')',
53 53
             'os_name' => Environment::osName(),
54
-            'database_name' => App::$Database->connection()->getDatabaseName() . ' (' . App::$Database->connection()->getDriverName() . ')',
54
+            'database_name' => App::$Database->connection()->getDatabaseName().' ('.App::$Database->connection()->getDriverName().')',
55 55
             'file_size' => $rootSize,
56 56
             'load_avg' => $loadAvg
57 57
         ];
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     public function actionFiles()
104 104
     {
105 105
         return $this->view->render('files', [
106
-            'connector' => App::$Alias->scriptUrl . '/api/main/files?lang=' . $this->request->getLanguage()
106
+            'connector' => App::$Alias->scriptUrl.'/api/main/files?lang='.$this->request->getLanguage()
107 107
         ]);
108 108
     }
109 109
 
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
      */
175 175
     public function actionDeleteroute()
176 176
     {
177
-        $type = (string)$this->request->query->get('type');
178
-        $loader = (string)$this->request->query->get('loader');
179
-        $source = Str::lowerCase((string)$this->request->query->get('path'));
177
+        $type = (string) $this->request->query->get('type');
178
+        $loader = (string) $this->request->query->get('loader');
179
+        $source = Str::lowerCase((string) $this->request->query->get('path'));
180 180
 
181 181
         $model = new EntityDeleteRoute($type, $loader, $source);
182 182
         if ($model->send() && $model->validate()) {
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
     {
200 200
         $stats = App::$Cache->stats();
201 201
         // get size in mb from cache stats
202
-        $size = round((int)$stats['size'] / (1024*1024), 2);
202
+        $size = round((int) $stats['size'] / (1024 * 1024), 2);
203 203
 
204 204
         // check if submited
205 205
         if ($this->request->request->get('clearcache', false)) {
Please login to merge, or discard this patch.
Apps/Controller/Admin/Comments.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     public function actionIndex()
41 41
     {
42 42
         // set current page and offset
43
-        $page = (int)$this->request->query->get('page');
43
+        $page = (int) $this->request->query->get('page');
44 44
         $offset = $page * self::ITEM_PER_PAGE;
45 45
 
46 46
         // initialize active record model
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
     public function actionDelete($type, $id = 0)
141 141
     {
142 142
         // sounds like a multiply delete definition
143
-        if ($id === 0 || (int)$id < 1) {
143
+        if ($id === 0 || (int) $id < 1) {
144 144
             $ids = $this->request->query->get('selected');
145 145
             if (Obj::isArray($ids) && Arr::onlyNumericValues($ids)) {
146 146
                 $id = $ids;
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
         if ($model->send() && $model->validate()) {
175 175
             $model->make();
176 176
             App::$Session->getFlashBag()->add('success', __('Comments or answers are successful deleted!'));
177
-            $this->response->redirect('comments/' . ($type === 'answer' ? 'answerlist' : 'index'));
177
+            $this->response->redirect('comments/'.($type === 'answer' ? 'answerlist' : 'index'));
178 178
         }
179 179
 
180 180
         // render view
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
     public function actionPublish($type, $id = 0)
196 196
     {
197 197
         // check if it multiple accept ids
198
-        if ($id === 0 || (int)$id < 1) {
198
+        if ($id === 0 || (int) $id < 1) {
199 199
             $ids = $this->request->query->get('selected');
200 200
             if (Obj::isArray($ids) && Arr::onlyNumericValues($ids)) {
201 201
                 $id = $ids;
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
         if ($model->send()) {
230 230
             $model->make();
231 231
             App::$Session->getFlashBag()->add('success', __('Comments or answers are successful published'));
232
-            $this->response->redirect('comments/' . ($type === 'answer' ? 'answerlist' : 'index'));
232
+            $this->response->redirect('comments/'.($type === 'answer' ? 'answerlist' : 'index'));
233 233
         }
234 234
 
235 235
         return $this->view->render('publish', [
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
     public function actionAnswerlist()
247 247
     {
248 248
         // set current page and offset
249
-        $page = (int)$this->request->query->get('page');
249
+        $page = (int) $this->request->query->get('page');
250 250
         $offset = $page * self::ITEM_PER_PAGE;
251 251
 
252 252
         // initialize ar answers model
Please login to merge, or discard this patch.
Loader/Cron/index.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 /** set default locale */
15 15
 $_GET['lang'] = 'en';
16 16
 
17
-require_once(root . '/Loader/Autoload.php');
17
+require_once(root.'/Loader/Autoload.php');
18 18
 
19 19
 // make fast-access alias \App::$Object
20 20
 // class_alias('Ffcms\Core\App', 'App');
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     $logs = $cronManager->run();
43 43
     if (PHP_SAPI === 'cli') {
44 44
         if ($logs !== null && \Ffcms\Core\Helper\Type\Obj::isArray($logs) && count($logs) > 0) {
45
-            echo 'Run cron tasks: ' . PHP_EOL . implode(PHP_EOL, $logs);
45
+            echo 'Run cron tasks: '.PHP_EOL.implode(PHP_EOL, $logs);
46 46
         } else {
47 47
             echo 'No tasks runned';
48 48
         }
Please login to merge, or discard this patch.
Extend/Core/Arch/FrontAppController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         }
32 32
 
33 33
         // add localizations
34
-        App::$Translate->append(App::$Alias->currentViewPath . '/I18n/' . App::$Request->getLanguage() . '.php');
34
+        App::$Translate->append(App::$Alias->currentViewPath.'/I18n/'.App::$Request->getLanguage().'.php');
35 35
 
36 36
         parent::__construct();
37 37
     }
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
         }
55 55
 
56 56
         // check if disabled (0 = enabled, anything else = on)
57
-        return (int)$this->application->disabled === 0;
57
+        return (int) $this->application->disabled === 0;
58 58
     }
59 59
 
60 60
     /**
@@ -66,10 +66,10 @@  discard block
 block discarded – undo
66 66
         if ($this->configs !== null) {
67 67
             return $this->configs;
68 68
         }
69
-        $configs = (array)unserialize($this->application->configs); // data always stored like a "string" objects
69
+        $configs = (array) unserialize($this->application->configs); // data always stored like a "string" objects
70 70
         foreach ($configs as $cfg => $value) {
71 71
             if (Obj::isLikeInt($value)) {
72
-                $configs[$cfg] = (int)$value; // convert string 1 "1" to int 1 1
72
+                $configs[$cfg] = (int) $value; // convert string 1 "1" to int 1 1
73 73
             }
74 74
         }
75 75
         $this->configs = $configs;
Please login to merge, or discard this patch.
Extend/Core/Arch/FrontWidget.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
     /**
34 34
      * Check if widget is enabled
35 35
      * @param string|null $name
36
-     * @return bool
36
+     * @return null|boolean
37 37
      */
38 38
     public static function enabled($name = null)
39 39
     {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
         }
52 52
 
53 53
         // if widget is disabled - lets return nothing
54
-        return !(bool)$wData->disabled;
54
+        return !(bool) $wData->disabled;
55 55
     }
56 56
 
57 57
 }
58 58
\ No newline at end of file
Please login to merge, or discard this patch.
Apps/View/Admin/default/content/content_update.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 foreach (\App::$Properties->get('languages') as $lang) {
43 43
     $generalItems[] = [
44 44
         'type' => 'tab',
45
-        'text' => __('Lang') . ': ' . Str::upperCase($lang),
46
-        'content' => $form->field('title.' . $lang, 'text', ['class' => 'form-control'], __('Please, enter the title of your material for current language locale'), 'content/form/tab_content_update') .
47
-            $form->field('text.' . $lang, 'textarea', ['class' => 'form-control wysiwyg', 'rows' => 7, 'html' => true], null, 'content/form/tab_content_update'),
45
+        'text' => __('Lang').': '.Str::upperCase($lang),
46
+        'content' => $form->field('title.'.$lang, 'text', ['class' => 'form-control'], __('Please, enter the title of your material for current language locale'), 'content/form/tab_content_update').
47
+            $form->field('text.'.$lang, 'textarea', ['class' => 'form-control wysiwyg', 'rows' => 7, 'html' => true], null, 'content/form/tab_content_update'),
48 48
         'html' => true,
49 49
         'active' => $lang === \App::$Request->getLanguage(),
50 50
         '!secure' => true
@@ -52,10 +52,10 @@  discard block
 block discarded – undo
52 52
 
53 53
     $propertiesItems[] = [
54 54
         'type' => 'tab',
55
-        'text' => __('Lang') . ': ' . Str::upperCase($lang),
56
-        'content' => $form->field('metaTitle.' . $lang, 'text', ['class' => 'form-control'], __('Enter meta param title for page title. Recoomended: 50-70 characters')) .
57
-            $form->field('metaKeywords.' . $lang, 'text', ['class' => 'form-control'], __('Enter meta param keywords for this content, separated by comma. Example: home, door, dog')) .
58
-            $form->field('metaDescription.' . $lang, 'text', ['class' => 'form-control'], __('Enter meta param description for this content. Recommended is 100-150 characters')),
55
+        'text' => __('Lang').': '.Str::upperCase($lang),
56
+        'content' => $form->field('metaTitle.'.$lang, 'text', ['class' => 'form-control'], __('Enter meta param title for page title. Recoomended: 50-70 characters')).
57
+            $form->field('metaKeywords.'.$lang, 'text', ['class' => 'form-control'], __('Enter meta param keywords for this content, separated by comma. Example: home, door, dog')).
58
+            $form->field('metaDescription.'.$lang, 'text', ['class' => 'form-control'], __('Enter meta param description for this content. Recommended is 100-150 characters')),
59 59
         'html' => true,
60 60
         '!secure' => true,
61 61
         'active' => $lang === \App::$Request->getLanguage()
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     <div class="dropzone dropzone-previews" id="ffcms-dropzone"></div>
91 91
 </div>
92 92
 <div class="col-md-4">
93
-    ' . $form->field('poster', 'select', ['options' => [__('Not selected...')], 'class' => 'form-control'], __('Select image from gallery as a poster for this content')) . '
93
+    ' . $form->field('poster', 'select', ['options' => [__('Not selected...')], 'class' => 'form-control'], __('Select image from gallery as a poster for this content')).'
94 94
 </div>
95 95
 </div><br/><br/>';
96 96
 ?>
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
         ['type' => 'tab', 'text' => __('Gallery'), 'content' => $galleryTab, 'html' => true, '!secure' => true],
104 104
         ['type' => 'tab', 'text' => __('Other'), 'content' => $otherTab, 'html' => true, '!secure' => true]
105 105
     ]
106
-]);?>
106
+]); ?>
107 107
 
108 108
 <?= $form->field('galleryFreeId', 'hidden') ?>
109 109
 <?= $form->submitButton(__('Save'), ['class' => 'btn btn-primary']) ?>&nbsp;
@@ -112,14 +112,14 @@  discard block
 block discarded – undo
112 112
 
113 113
 <?php
114 114
 // load max length display plugin
115
-\App::$Alias->setCustomLibrary('js', \App::$Alias->currentViewUrl . '/assets/js/plugins/maxlength.js');
115
+\App::$Alias->setCustomLibrary('js', \App::$Alias->currentViewUrl.'/assets/js/plugins/maxlength.js');
116 116
 // load datapicker plugin
117
-\App::$Alias->setCustomLibrary('css', \App::$Alias->currentViewUrl . '/assets/css/plugins/datapick/datapick.css');
118
-\App::$Alias->setCustomLibrary('js', \App::$Alias->currentViewUrl . '/assets/js/plugins/datapick.js');
117
+\App::$Alias->setCustomLibrary('css', \App::$Alias->currentViewUrl.'/assets/css/plugins/datapick/datapick.css');
118
+\App::$Alias->setCustomLibrary('js', \App::$Alias->currentViewUrl.'/assets/js/plugins/datapick.js');
119 119
 // load jquery-upload plugin
120
-\App::$Alias->setCustomLibrary('css', \App::$Alias->scriptUrl . '/vendor/bower/dropzone/dist/min/dropzone.min.css');
121
-\App::$Alias->setCustomLibrary('css', \App::$Alias->scriptUrl . '/vendor/bower/dropzone/dist/min/basic.min.css');
122
-\App::$Alias->setCustomLibrary('js', \App::$Alias->scriptUrl . '/vendor/bower/dropzone/dist/min/dropzone.min.js');
120
+\App::$Alias->setCustomLibrary('css', \App::$Alias->scriptUrl.'/vendor/bower/dropzone/dist/min/dropzone.min.css');
121
+\App::$Alias->setCustomLibrary('css', \App::$Alias->scriptUrl.'/vendor/bower/dropzone/dist/min/basic.min.css');
122
+\App::$Alias->setCustomLibrary('js', \App::$Alias->scriptUrl.'/vendor/bower/dropzone/dist/min/dropzone.min.js');
123 123
 ?>
124 124
 
125 125
 <script>
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
             var DropzoneFiles = [];
217 217
             $('#ffcms-dropzone').dropzone({
218 218
                 url: script_url+'/api/content/galleryupload/<?= $model->galleryFreeId ?>?lang='+script_lang,
219
-                dictDefaultMessage: '<?= __('Drop files here to upload in gallery') . '<br />' . __('(or click here)') ?>',
219
+                dictDefaultMessage: '<?= __('Drop files here to upload in gallery').'<br />'.__('(or click here)') ?>',
220 220
                 acceptedFiles: ".jpeg,.jpg,.png,.gif,.webp",
221 221
                 addRemoveLinks: true,
222 222
                 removedfile: function (file) { // file remove click, lets try to remove file from server & make visual changes
Please login to merge, or discard this patch.
Apps/Controller/Api/Content.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -33,12 +33,12 @@  discard block
 block discarded – undo
33 33
         parent::before();
34 34
         $configs = AppRecord::getConfigs('app', 'Content');
35 35
         // prevent null-type config data
36
-        if ((int)$configs['gallerySize'] > 0) {
37
-            $this->maxSize = (int)$configs['gallerySize'] * 1024;
36
+        if ((int) $configs['gallerySize'] > 0) {
37
+            $this->maxSize = (int) $configs['gallerySize'] * 1024;
38 38
         }
39 39
 
40
-        if ((int)$configs['galleryResize'] > 0) {
41
-            $this->maxResize = (int)$configs['galleryResize'];
40
+        if ((int) $configs['galleryResize'] > 0) {
41
+            $this->maxResize = (int) $configs['galleryResize'];
42 42
         }
43 43
     }
44 44
     
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
         }
118 118
 
119 119
         // check if directory exist
120
-        if (!Directory::exist('/upload/gallery/' . $id)) {
121
-            Directory::create('/upload/gallery/' . $id);
120
+        if (!Directory::exist('/upload/gallery/'.$id)) {
121
+            Directory::create('/upload/gallery/'.$id);
122 122
         }
123 123
 
124 124
         // get file object
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 
131 131
         // check file size
132 132
         if ($file->getSize() < 1 || $file->getSize() > $this->maxSize) {
133
-            throw new ForbiddenException(__('File size is too big. Max size: %size%kb', ['size' => (int)($this->maxSize/1024)]));
133
+            throw new ForbiddenException(__('File size is too big. Max size: %size%kb', ['size' => (int) ($this->maxSize / 1024)]));
134 134
         }
135 135
 
136 136
         // check file extension
@@ -139,41 +139,41 @@  discard block
 block discarded – undo
139 139
         }
140 140
 
141 141
         // create origin directory
142
-        $originPath = '/upload/gallery/' . $id . '/orig/';
142
+        $originPath = '/upload/gallery/'.$id.'/orig/';
143 143
         if (!Directory::exist($originPath)) {
144 144
             Directory::create($originPath);
145 145
         }
146 146
 
147 147
         // lets make a new file name
148
-        $fileName = App::$Security->simpleHash($file->getClientOriginalName() . $file->getSize());
149
-        $fileNewName = $fileName . '.' . $file->guessExtension();
148
+        $fileName = App::$Security->simpleHash($file->getClientOriginalName().$file->getSize());
149
+        $fileNewName = $fileName.'.'.$file->guessExtension();
150 150
         // check if image is already loaded
151
-        if (File::exist($originPath . $fileNewName)) {
151
+        if (File::exist($originPath.$fileNewName)) {
152 152
             throw new ForbiddenException(__('File is always exists!'));
153 153
         }
154 154
         // save file from tmp to gallery origin directory
155 155
         $file->move(Normalize::diskFullPath($originPath), $fileNewName);
156 156
 
157 157
         // lets resize preview image for it
158
-        $thumbPath = '/upload/gallery/' . $id . '/thumb/';
158
+        $thumbPath = '/upload/gallery/'.$id.'/thumb/';
159 159
         if (!Directory::exist($thumbPath)) {
160 160
             Directory::create($thumbPath);
161 161
         }
162 162
 
163 163
         $thumb = new Image();
164
-        $thumb->setCacheDir(root . '/Private/Cache/images');
164
+        $thumb->setCacheDir(root.'/Private/Cache/images');
165 165
 
166 166
         // open original file, resize it and save
167
-        $thumbSaveName = Normalize::diskFullPath($thumbPath) . '/' . $fileName . '.jpg';
168
-        $thumb->open(Normalize::diskFullPath($originPath) . DIRECTORY_SEPARATOR . $fileNewName)
167
+        $thumbSaveName = Normalize::diskFullPath($thumbPath).'/'.$fileName.'.jpg';
168
+        $thumb->open(Normalize::diskFullPath($originPath).DIRECTORY_SEPARATOR.$fileNewName)
169 169
             ->cropResize($this->maxResize)
170 170
             ->save($thumbSaveName, 'jpg', 90);
171 171
         $thumb = null;
172 172
 
173 173
         $this->setJsonHeader();
174 174
         return json_encode(['status' => 1, 'file' => [
175
-            'thumbnailUrl' => '/upload/gallery/' . $id . '/thumb/' . $fileName . '.jpg',
176
-            'url' => '/upload/gallery/' . $id . '/orig/' . $fileNewName,
175
+            'thumbnailUrl' => '/upload/gallery/'.$id.'/thumb/'.$fileName.'.jpg',
176
+            'url' => '/upload/gallery/'.$id.'/orig/'.$fileNewName,
177 177
             'name' => $fileNewName
178 178
         ]]);
179 179
     }
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
             throw new NativeException('Permission denied');
198 198
         }
199 199
 
200
-        $thumbDir = Normalize::diskFullPath('/upload/gallery/' . $id . '/orig/');
200
+        $thumbDir = Normalize::diskFullPath('/upload/gallery/'.$id.'/orig/');
201 201
         if (!Directory::exist($thumbDir)) {
202 202
             throw new NotFoundException('Nothing found');
203 203
         }
@@ -212,10 +212,10 @@  discard block
 block discarded – undo
212 212
             $fileExt = Str::lastIn($file, '.');
213 213
             $fileName = Str::sub($file, 0, -Str::length($fileExt));
214 214
             $output[] = [
215
-                'thumbnailUrl' => '/upload/gallery/' . $id . '/thumb/' . $fileName . '.jpg',
216
-                'url' => '/upload/gallery/' . $id . '/orig/' . $file,
215
+                'thumbnailUrl' => '/upload/gallery/'.$id.'/thumb/'.$fileName.'.jpg',
216
+                'url' => '/upload/gallery/'.$id.'/orig/'.$file,
217 217
                 'name' => $file,
218
-                'size' => File::size('/upload/gallery/' . $id . '/orig/' . $file)
218
+                'size' => File::size('/upload/gallery/'.$id.'/orig/'.$file)
219 219
             ];
220 220
         }
221 221
 
@@ -246,8 +246,8 @@  discard block
 block discarded – undo
246 246
         }
247 247
 
248 248
         // generate path
249
-        $thumb = '/upload/gallery/' . $id . '/thumb/' . $fileName . '.jpg';
250
-        $full = '/upload/gallery/' . $id . '/orig/' . $file;
249
+        $thumb = '/upload/gallery/'.$id.'/thumb/'.$fileName.'.jpg';
250
+        $full = '/upload/gallery/'.$id.'/orig/'.$file;
251 251
 
252 252
         // check if file exists and remove
253 253
         if (File::exist($thumb) || File::exist($full)) {
Please login to merge, or discard this patch.
Apps/Controller/Console/Main.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -2,7 +2,6 @@  discard block
 block discarded – undo
2 2
 
3 3
 namespace Apps\Controller\Console;
4 4
 
5
-use Apps\ActiveRecord\App;
6 5
 use Ffcms\Console\Console;
7 6
 use Ffcms\Core\Exception\NativeException;
8 7
 use Ffcms\Core\Helper\FileSystem\Directory;
@@ -11,7 +10,6 @@  discard block
 block discarded – undo
11 10
 use Ffcms\Core\Helper\Type\Obj;
12 11
 use Ffcms\Core\Helper\Type\Str;
13 12
 use Apps\Controller\Console\Db as DbController;
14
-use Symfony\Component\VarDumper\Caster\ConstStub;
15 13
 
16 14
 class Main
17 15
 {
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -28,20 +28,20 @@  discard block
 block discarded – undo
28 28
      */
29 29
     public function actionHelp()
30 30
     {
31
-        $text = "You are using FFCMS console application." . PHP_EOL;
32
-        $text .= "This application support next basic commands:" . PHP_EOL;
33
-        $text .= "\t main/info - show info about CMS" . PHP_EOL;
34
-        $text .= "\t main/install - install FFCMS from console line." . PHP_EOL;
35
-        $text .= "\t main/update - update package to current minor version if available." . PHP_EOL;
36
-        $text .= "\t main/chmod - update chmod for ffcms special folders. Can be used after project deployment." . PHP_EOL;
37
-        $text .= "\t main/buildperms - build and update permissions map for applications." . PHP_EOL;
38
-        $text .= "\t create/model workground/modelName - create model carcase default." . PHP_EOL;
39
-        $text .= "\t create/ar activeRecordName - create active record table and model." . PHP_EOL;
40
-        $text .= "\t create/controller workground/controllerName - create default controller carcase." . PHP_EOL;
41
-        $text .= "\t create/widget workground/widgetName/widgetName - create default widget carcase." . PHP_EOL;
42
-        $text .= "\t db/import activeRecordName - import to database single schema from ar model." . PHP_EOL;
43
-        $text .= "\t db/importAll - import all active record tables to database." . PHP_EOL;
44
-        $text .= "\t db/adduser - add new user into database." . PHP_EOL;
31
+        $text = "You are using FFCMS console application.".PHP_EOL;
32
+        $text .= "This application support next basic commands:".PHP_EOL;
33
+        $text .= "\t main/info - show info about CMS".PHP_EOL;
34
+        $text .= "\t main/install - install FFCMS from console line.".PHP_EOL;
35
+        $text .= "\t main/update - update package to current minor version if available.".PHP_EOL;
36
+        $text .= "\t main/chmod - update chmod for ffcms special folders. Can be used after project deployment.".PHP_EOL;
37
+        $text .= "\t main/buildperms - build and update permissions map for applications.".PHP_EOL;
38
+        $text .= "\t create/model workground/modelName - create model carcase default.".PHP_EOL;
39
+        $text .= "\t create/ar activeRecordName - create active record table and model.".PHP_EOL;
40
+        $text .= "\t create/controller workground/controllerName - create default controller carcase.".PHP_EOL;
41
+        $text .= "\t create/widget workground/widgetName/widgetName - create default widget carcase.".PHP_EOL;
42
+        $text .= "\t db/import activeRecordName - import to database single schema from ar model.".PHP_EOL;
43
+        $text .= "\t db/importAll - import all active record tables to database.".PHP_EOL;
44
+        $text .= "\t db/adduser - add new user into database.".PHP_EOL;
45 45
         return $text;
46 46
     }
47 47
 
@@ -51,17 +51,17 @@  discard block
 block discarded – undo
51 51
      */
52 52
     public function actionInfo()
53 53
     {
54
-        $text = "Information about FFCMS package and environment:" . PHP_EOL;
55
-        $text .= "\t PHP version: " . phpversion() . PHP_EOL;
56
-        $text .= "\t Dist path: " . root . PHP_EOL;
57
-        $text .= "\t Used version: " . Console::$Properties->version['num'] . ' [build: ' . Console::$Properties->version['date'] . ']' . PHP_EOL;
58
-        $text .= "Information about FFCMS cmf packages:" . PHP_EOL;
54
+        $text = "Information about FFCMS package and environment:".PHP_EOL;
55
+        $text .= "\t PHP version: ".phpversion().PHP_EOL;
56
+        $text .= "\t Dist path: ".root.PHP_EOL;
57
+        $text .= "\t Used version: ".Console::$Properties->version['num'].' [build: '.Console::$Properties->version['date'].']'.PHP_EOL;
58
+        $text .= "Information about FFCMS cmf packages:".PHP_EOL;
59 59
 
60 60
         $composerInfo = File::read('/composer.lock');
61 61
         if (false !== $composerInfo) {
62 62
             $jsonInfo = json_decode($composerInfo);
63 63
             foreach ($jsonInfo->packages as $item) {
64
-                $text .= "\t Package: " . $item->name . ' => ' . $item->version . PHP_EOL;
64
+                $text .= "\t Package: ".$item->name.' => '.$item->version.PHP_EOL;
65 65
             }
66 66
         } else {
67 67
             $text .= "\t Composer is never be used - no information available.";
@@ -97,16 +97,16 @@  discard block
 block discarded – undo
97 97
             preg_match_all('/public function action(\w*?)\(/', $byte, $matches); // matches[0] contains all methods ;)
98 98
             if (Obj::isArray($matches[1]) && count($matches[1]) > 0) {
99 99
                 foreach ($matches[1] as $perm) {
100
-                    $permissions[] = 'Admin/' . $className . '/' . $perm;
100
+                    $permissions[] = 'Admin/'.$className.'/'.$perm;
101 101
                 }
102 102
             }
103 103
         }
104 104
 
105 105
         // prepare save string
106
-        $stringSave = "<?php \n\nreturn " . var_export($permissions, true) . ';';
106
+        $stringSave = "<?php \n\nreturn ".var_export($permissions, true).';';
107 107
         File::write('/Private/Config/Permissions.php', $stringSave);
108 108
 
109
-        return 'Permissions configuration is successful updated! Founded permissions: ' . count($permissions);
109
+        return 'Permissions configuration is successful updated! Founded permissions: '.count($permissions);
110 110
     }
111 111
 
112 112
     /**
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
             if (Directory::exist($obj)) {
121 121
                 Directory::recursiveChmod($obj, 0777);
122 122
             } elseif (File::exist($obj)) {
123
-                chmod(root . $obj, 0777);
123
+                chmod(root.$obj, 0777);
124 124
             } else {
125
-                $errors .= Console::$Output->write('Filesystem object is not founded: ' . $obj);
125
+                $errors .= Console::$Output->write('Filesystem object is not founded: '.$obj);
126 126
             }
127 127
         }
128 128
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         }
142 142
 
143 143
         echo Console::$Output->writeHeader('License start');
144
-        echo File::read('/LICENSE') . PHP_EOL;
144
+        echo File::read('/LICENSE').PHP_EOL;
145 145
         echo Console::$Output->writeHeader('License end');
146 146
 
147 147
         $config = Console::$Properties->get('database');
@@ -160,38 +160,38 @@  discard block
 block discarded – undo
160 160
 
161 161
         // database config from input
162 162
         echo Console::$Output->writeHeader('Database connection configuration');
163
-        echo 'Driver(default:' . $config['driver'] . '):';
163
+        echo 'Driver(default:'.$config['driver'].'):';
164 164
         $dbDriver = Console::$Input->read();
165 165
         if (Arr::in($dbDriver, ['mysql', 'pgsql', 'sqlite'])) {
166 166
             $newConfig['driver'] = $dbDriver;
167 167
         }
168 168
 
169 169
         // for sqlite its would be a path
170
-        echo 'Host(default:' . $config['host'] . '):';
170
+        echo 'Host(default:'.$config['host'].'):';
171 171
         $dbHost = Console::$Input->read();
172 172
         if (!Str::likeEmpty($dbHost)) {
173 173
             $newConfig['host'] = $dbHost;
174 174
         }
175 175
 
176
-        echo 'Database name(default:' . $config['database'] . '):';
176
+        echo 'Database name(default:'.$config['database'].'):';
177 177
         $dbName = Console::$Input->read();
178 178
         if (!Str::likeEmpty($dbName)) {
179 179
             $newConfig['database'] = $dbName;
180 180
         }
181 181
 
182
-        echo 'User(default:' . $config['username'] . '):';
182
+        echo 'User(default:'.$config['username'].'):';
183 183
         $dbUser = Console::$Input->read();
184 184
         if (!Str::likeEmpty($dbUser)) {
185 185
             $newConfig['username'] = $dbUser;
186 186
         }
187 187
 
188
-        echo 'Password(default:' . $config['password'] . '):';
188
+        echo 'Password(default:'.$config['password'].'):';
189 189
         $dbPwd = Console::$Input->read();
190 190
         if (!Str::likeEmpty($dbPwd)) {
191 191
             $newConfig['password'] = $dbPwd;
192 192
         }
193 193
 
194
-        echo 'Table prefix(default:' . $config['prefix'] . '):';
194
+        echo 'Table prefix(default:'.$config['prefix'].'):';
195 195
         $dbPrefix = Console::$Input->read();
196 196
         if (!Str::likeEmpty($dbPrefix)) {
197 197
             $newConfig['prefix'] = $dbPrefix;
@@ -204,11 +204,11 @@  discard block
 block discarded – undo
204 204
         try {
205 205
             Console::$Database->connection('install')->getDatabaseName();
206 206
         } catch (\Exception $e) {
207
-            return 'Testing database connection is failed! Run installer again and pass tested connection data! Log: ' . $e->getMessage();
207
+            return 'Testing database connection is failed! Run installer again and pass tested connection data! Log: '.$e->getMessage();
208 208
         }
209 209
 
210 210
         // autoload isn't work here
211
-        include(root . '/Apps/Controller/Console/Db.php');
211
+        include(root.'/Apps/Controller/Console/Db.php');
212 212
 
213 213
         // import db data
214 214
         $dbController = new DbController();
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 
217 217
         // set website send from email from input
218 218
         $emailConfig = Console::$Properties->get('adminEmail');
219
-        echo 'Website sendFrom email(default: ' . $emailConfig . '):';
219
+        echo 'Website sendFrom email(default: '.$emailConfig.'):';
220 220
         $email = Console::$Input->read();
221 221
         if (!Str::isEmail($email)) {
222 222
             $email = $emailConfig;
@@ -237,9 +237,9 @@  discard block
 block discarded – undo
237 237
         $allCfg['adminEmail'] = $email;
238 238
         $allCfg['baseDomain'] = $baseDomain;
239 239
         echo Console::$Output->write('Generate password salt for BLOWFISH crypt');
240
-        $allCfg['passwordSalt'] = '$2a$07$' . Str::randomLatinNumeric(mt_rand(21, 30)) . '$';
240
+        $allCfg['passwordSalt'] = '$2a$07$'.Str::randomLatinNumeric(mt_rand(21, 30)).'$';
241 241
         echo Console::$Output->write('Generate security cookies for debug panel');
242
-        $allCfg['debug']['cookie']['key'] = 'fdebug_' . Str::randomLatinNumeric(mt_rand(8, 32));
242
+        $allCfg['debug']['cookie']['key'] = 'fdebug_'.Str::randomLatinNumeric(mt_rand(8, 32));
243 243
         $allCfg['debug']['cookie']['value'] = Str::randomLatinNumeric(mt_rand(32, 128));
244 244
 
245 245
         // write config data
Please login to merge, or discard this patch.