Completed
Push — master ( c9b7ea...c1fd74 )
by Mihail
02:38
created
src/Ffcms/Core/Traits/ModelValidator.php 3 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
                     } elseif (method_exists($class, $obj)) { // maybe its a function?
139 139
                         $class = $class::$obj; // call function
140 140
                     } else {
141
-                        throw new SyntaxException('Filter callback execution failed: ' . $filterName);
141
+                        throw new SyntaxException('Filter callback execution failed: '.$filterName);
142 142
                     }
143 143
 
144 144
                 }
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
             if (method_exists($class, $method)) {
149 149
                 $check = @$class::$method($fieldValue, $filterArgs);
150 150
             } else {
151
-                throw new SyntaxException('Filter callback execution failed: ' . $filterName);
151
+                throw new SyntaxException('Filter callback execution failed: '.$filterName);
152 152
             }
153 153
         } elseif (method_exists('Ffcms\Core\Helper\ModelFilters', $filterName)) { // only full namespace\class path based :(
154 154
             if ($filterArgs != null) {
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
                 $check = ModelFilters::$filterName($fieldValue);
158 158
             }
159 159
         } else {
160
-            throw new SyntaxException('Filter "' . $filterName . '" is not exist');
160
+            throw new SyntaxException('Filter "'.$filterName.'" is not exist');
161 161
         }
162 162
         if ($check !== true) { // if one from all validation tests is fail - mark as incorrect attribute
163 163
             $this->_badAttr[] = $propertyName;
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,6 @@
 block discarded – undo
8 8
 use Ffcms\Core\Exception\SyntaxException;
9 9
 use Ffcms\Core\Helper\ModelFilters;
10 10
 use Ffcms\Core\Helper\Type\Any;
11
-use Ffcms\Core\Helper\Type\Obj;
12 11
 use Ffcms\Core\Helper\Type\Str;
13 12
 
14 13
 /**
Please login to merge, or discard this patch.
Braces   +24 added lines, -16 removed lines patch added patch discarded remove patch
@@ -59,21 +59,24 @@  discard block
 block discarded – undo
59 59
     public function runValidate(array $rules = null)
60 60
     {
61 61
         // skip validation on empty rules
62
-        if ($rules === null)
63
-            return true;
62
+        if ($rules === null) {
63
+                    return true;
64
+        }
64 65
 
65 66
         $success = true;
66 67
         // list each rule as single one
67 68
         foreach ($rules as $rule) {
68 69
             // 0 = field (property) name, 1 = filter name, 2 = filter value
69
-            if ($rule[0] === null || $rule[1] === null)
70
-                continue;
70
+            if ($rule[0] === null || $rule[1] === null) {
71
+                            continue;
72
+            }
71 73
 
72 74
             $propertyName = $rule[0];
73 75
             $validationRule = $rule[1];
74 76
             $validationValue = null;
75
-            if (isset($rule[2]))
76
-                $validationValue = $rule[2];
77
+            if (isset($rule[2])) {
78
+                            $validationValue = $rule[2];
79
+            }
77 80
 
78 81
             // check if target field defined as array and make recursive validation
79 82
             if (Any::isArray($propertyName)) {
@@ -170,8 +173,9 @@  discard block
 block discarded – undo
170 173
                 if ($propertyName !== $field_set_name) { // array-based property
171 174
                     $dot_path = trim(strstr($propertyName, '.'), '.');
172 175
                     // prevent throws any exceptions for null and false objects
173
-                    if (!Any::isArray($this->{$field_set_name}))
174
-                        $this->{$field_set_name} = [];
176
+                    if (!Any::isArray($this->{$field_set_name})) {
177
+                                            $this->{$field_set_name} = [];
178
+                    }
175 179
 
176 180
                     // use dot-data provider to compile output array
177 181
                     $dotData = new DotData($this->{$field_set_name});
@@ -201,14 +205,16 @@  discard block
 block discarded – undo
201 205
         $sources = $this->sources();
202 206
         $types = $this->types();
203 207
         // validate sources for current field
204
-        if (array_key_exists($propertyName, $sources))
205
-            $inputType = Str::lowerCase($sources[$propertyName]);
208
+        if (array_key_exists($propertyName, $sources)) {
209
+                    $inputType = Str::lowerCase($sources[$propertyName]);
210
+        }
206 211
 
207 212
 
208 213
         // check if field is array-nested element by dots and use first element as general
209 214
         $filterField = $propertyName;
210
-        if (array_key_exists($filterField, $types))
211
-            $filterType = Str::lowerCase($types[$filterField]);
215
+        if (array_key_exists($filterField, $types)) {
216
+                    $filterType = Str::lowerCase($types[$filterField]);
217
+        }
212 218
 
213 219
         // get clear field value
214 220
         $propertyValue = $this->getRequest($propertyName, $inputType);
@@ -310,8 +316,9 @@  discard block
 block discarded – undo
310 316
      */
311 317
     public function getRequest($param, $method = null)
312 318
     {
313
-        if ($method === null)
314
-            $method = $this->_sendMethod;
319
+        if ($method === null) {
320
+                    $method = $this->_sendMethod;
321
+        }
315 322
 
316 323
         $method = Str::lowerCase($method);
317 324
         // get root request as array or string
@@ -335,8 +342,9 @@  discard block
 block discarded – undo
335 342
         if (Str::contains('.', $param)) {
336 343
             $response = $request;
337 344
             foreach (explode('.', $param) as $path) {
338
-                if (!array_key_exists($path, $response))
339
-                    return null;
345
+                if (!array_key_exists($path, $response)) {
346
+                                    return null;
347
+                }
340 348
                 // find deep array nesting offset
341 349
                 $response = $response[$path];
342 350
             }
Please login to merge, or discard this patch.
src/Ffcms/Core/Debug/DebugMeasure.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,8 +16,9 @@  discard block
 block discarded – undo
16 16
      */
17 17
     public function startMeasure(string $name): void
18 18
     {
19
-        if (App::$Debug)
20
-            App::$Debug->startMeasure($name);
19
+        if (App::$Debug) {
20
+                    App::$Debug->startMeasure($name);
21
+        }
21 22
     }
22 23
 
23 24
     /**
@@ -26,7 +27,8 @@  discard block
 block discarded – undo
26 27
      */
27 28
     public function stopMeasure(string $name): void
28 29
     {
29
-        if (App::$Debug)
30
-            App::$Debug->stopMeasure($name);
30
+        if (App::$Debug) {
31
+                    App::$Debug->stopMeasure($name);
32
+        }
31 33
     }
32 34
 }
33 35
\ No newline at end of file
Please login to merge, or discard this patch.
src/Ffcms/Core/Helper/HTML/System/Dom.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
     {
94 94
         // looks like a single tag, <img src="" class="" />, <hr class="" />
95 95
         if (Arr::in($name, self::$singleTags)) {
96
-            return '<' . $name . self::applyProperties($properties) . ' />';
97
-        } elseif(Arr::in($name, self::$containerTags)) { // looks like a container tag, <div class=""></div>
98
-            return '<' . $name . self::applyProperties($properties) . '>' . $content . '</' . $name . '>';
96
+            return '<'.$name.self::applyProperties($properties).' />';
97
+        } elseif (Arr::in($name, self::$containerTags)) { // looks like a container tag, <div class=""></div>
98
+            return '<'.$name.self::applyProperties($properties).'>'.$content.'</'.$name.'>';
99 99
         }
100 100
 
101 101
         // empty response
@@ -122,9 +122,9 @@  discard block
 block discarded – undo
122 122
             }
123 123
             // sounds like single standalone property, ex required, selected etc
124 124
             if ($value === null || $value === false) {
125
-                $build .= ' ' . htmlentities($property, ENT_QUOTES, "UTF-8");
125
+                $build .= ' '.htmlentities($property, ENT_QUOTES, "UTF-8");
126 126
             } else { // sounds like a classic key="value" property
127
-                $build .= ' ' . htmlentities($property, ENT_QUOTES, "UTF-8") . '="' . htmlentities($value, ENT_QUOTES, "UTF-8") . '"';
127
+                $build .= ' '.htmlentities($property, ENT_QUOTES, "UTF-8").'="'.htmlentities($value, ENT_QUOTES, "UTF-8").'"';
128 128
             }
129 129
         }
130 130
         return $build;
Please login to merge, or discard this patch.
src/Ffcms/Core/Network/Request.php 3 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -60,11 +60,11 @@  discard block
 block discarded – undo
60 60
 
61 61
         $basePath = trim(App::$Properties->get('basePath'), '/');
62 62
         if ($basePath !== null && Str::length($basePath) > 0) {
63
-            $basePath = '/' . $basePath;
63
+            $basePath = '/'.$basePath;
64 64
         }
65 65
 
66 66
         if (!defined('env_no_uri') || env_no_uri === false) {
67
-            $basePath .= '/' . strtolower(env_name);
67
+            $basePath .= '/'.strtolower(env_name);
68 68
         }
69 69
 
70 70
         // we never try to use path's without friendly url's
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
             } else {
91 91
                 // try to find language in pathway
92 92
                 foreach (App::$Properties->get('languages') as $lang) {
93
-                    if (Str::startsWith('/' . $lang, $this->getPathInfo())) {
93
+                    if (Str::startsWith('/'.$lang, $this->getPathInfo())) {
94 94
                         $this->language = $lang;
95 95
                         $this->languageInPath = true;
96 96
                     }
@@ -117,11 +117,11 @@  discard block
 block discarded – undo
117 117
                     // parse query string
118 118
                     $queryString = null;
119 119
                     if (count($this->query->all()) > 0) {
120
-                        $queryString = '?' . http_build_query($this->query->all());
120
+                        $queryString = '?'.http_build_query($this->query->all());
121 121
                     }
122 122
 
123 123
                     // build response with redirect to language-based path
124
-                    $response = new Redirect($this->getSchemeAndHttpHost() . $this->basePath . '/' . $userLang . $this->getPathInfo() . $queryString);
124
+                    $response = new Redirect($this->getSchemeAndHttpHost().$this->basePath.'/'.$userLang.$this->getPathInfo().$queryString);
125 125
                     $response->send();
126 126
                     exit();
127 127
                 }
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
         if (array_key_exists($pathway, $routing['Redirect'])) {
181 181
             $target = $this->getSchemeAndHttpHost(); // . $this->getBasePath() . '/' . rtrim($routing['Redirect'][$pathway], '/');
182 182
             if ($this->getBasePath() !== null && !Str::likeEmpty($this->getBasePath())) {
183
-                $target .= '/' . $this->getBasePath();
183
+                $target .= '/'.$this->getBasePath();
184 184
             }
185 185
             $target .= rtrim($routing['Redirect'][$pathway], '/');
186 186
             $redirect = new Redirect($target);
@@ -206,9 +206,9 @@  discard block
 block discarded – undo
206 206
             // find "new path" as binding uri slug
207 207
             $binding = array_search($pathway, $map, true);
208 208
             // build url to redirection
209
-            $url = $this->getSchemeAndHttpHost() . $this->getBasePath() . '/';
209
+            $url = $this->getSchemeAndHttpHost().$this->getBasePath().'/';
210 210
             if (App::$Properties->get('multiLanguage')) {
211
-                $url .= $this->language . '/';
211
+                $url .= $this->language.'/';
212 212
             }
213 213
             $url .= ltrim($binding, '/');
214 214
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
     {
303 303
         $route = $this->languageInPath ? Str::sub(parent::getPathInfo(), Str::length($this->language) + 1) : parent::getPathInfo();
304 304
         if (!Str::startsWith('/', $route))
305
-            $route = '/' . $route;
305
+            $route = '/'.$route;
306 306
         return $route;
307 307
     }
308 308
 
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
      */
467 467
     public function getFullUrl(): string
468 468
     {
469
-        return $this->getSchemeAndHttpHost() . $this->getRequestUri();
469
+        return $this->getSchemeAndHttpHost().$this->getRequestUri();
470 470
     }
471 471
 
472 472
     /**
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,6 @@
 block discarded – undo
5 5
 use Ffcms\Core\App;
6 6
 use Ffcms\Core\Helper\Type\Any;
7 7
 use Ffcms\Core\Helper\Type\Arr;
8
-use Ffcms\Core\Helper\Type\Obj;
9 8
 use Ffcms\Core\Helper\Type\Str;
10 9
 use Symfony\Component\HttpFoundation\RedirectResponse as Redirect;
11 10
 use Symfony\Component\HttpFoundation\Request as FoundationRequest;
Please login to merge, or discard this patch.
Braces   +27 added lines, -18 removed lines patch added patch discarded remove patch
@@ -141,18 +141,21 @@  discard block
 block discarded – undo
141 141
         $routing = App::$Properties->getAll('Routing');
142 142
 
143 143
         // try to work with static aliases
144
-        if (Any::isArray($routing) && isset($routing['Alias'], $routing['Alias'][env_name]))
145
-            $pathway = $this->findStaticAliases($routing['Alias'][env_name], $pathway);
144
+        if (Any::isArray($routing) && isset($routing['Alias'], $routing['Alias'][env_name])) {
145
+                    $pathway = $this->findStaticAliases($routing['Alias'][env_name], $pathway);
146
+        }
146 147
 
147 148
         $this->setPathdata(explode('/', trim($pathway, '/')));
148 149
 
149 150
         // set default controller and action for undefined data
150
-        if (!$this->action)
151
-            $this->action = 'Index';
151
+        if (!$this->action) {
152
+                    $this->action = 'Index';
153
+        }
152 154
 
153 155
         // empty or contains backslashes? set to main
154
-        if (!$this->controller || Str::contains('\\', $this->controller))
155
-            $this->controller = 'Main';
156
+        if (!$this->controller || Str::contains('\\', $this->controller)) {
157
+                    $this->controller = 'Main';
158
+        }
156 159
 
157 160
         // find callback injection in routing configs (calculated in App::run())
158 161
         if (Any::isArray($routing) && isset($routing['Callback'], $routing['Callback'][env_name])) {
@@ -170,8 +173,9 @@  discard block
 block discarded – undo
170 173
         /** @var array $routing */
171 174
         $routing = App::$Properties->getAll('Routing');
172 175
 
173
-        if (!Any::isArray($routing) || !isset($routing['Redirect']) || !Any::isArray($routing['Redirect']))
174
-            return;
176
+        if (!Any::isArray($routing) || !isset($routing['Redirect']) || !Any::isArray($routing['Redirect'])) {
177
+                    return;
178
+        }
175 179
 
176 180
         // check if source uri is key in redirect target map
177 181
         if (array_key_exists($pathway, $routing['Redirect'])) {
@@ -230,8 +234,9 @@  discard block
 block discarded – undo
230 234
      */
231 235
     private function findDynamicCallbacks(array $map = null, ?string $controller = null)
232 236
     {
233
-        if ($map === null)
234
-            return;
237
+        if ($map === null) {
238
+                    return;
239
+        }
235 240
 
236 241
         // try to find global callback for this controller slug
237 242
         if (array_key_exists($controller, $map)) {
@@ -248,8 +253,9 @@  discard block
 block discarded – undo
248 253
     private function loadTrustedProxies()
249 254
     {
250 255
         $proxies = App::$Properties->get('trustedProxy');
251
-        if ($proxies === null || Str::likeEmpty($proxies))
252
-            return;
256
+        if ($proxies === null || Str::likeEmpty($proxies)) {
257
+                    return;
258
+        }
253 259
 
254 260
         $pList = explode(',', $proxies);
255 261
         $resultList = [];
@@ -265,8 +271,9 @@  discard block
 block discarded – undo
265 271
      */
266 272
     private function setPathdata(?array $pathArray = null)
267 273
     {
268
-        if (!Any::isArray($pathArray) || count($pathArray) < 1)
269
-            return;
274
+        if (!Any::isArray($pathArray) || count($pathArray) < 1) {
275
+                    return;
276
+        }
270 277
 
271 278
         // check if array length is more then 4 basic elements and slice it recursive
272 279
         if (count($pathArray) > 4) {
@@ -295,8 +302,9 @@  discard block
 block discarded – undo
295 302
     public function getPathInfo()
296 303
     {
297 304
         $route = $this->languageInPath ? Str::sub(parent::getPathInfo(), Str::length($this->language) + 1) : parent::getPathInfo();
298
-        if (!Str::startsWith('/', $route))
299
-            $route = '/' . $route;
305
+        if (!Str::startsWith('/', $route)) {
306
+                    $route = '/' . $route;
307
+        }
300 308
         return $route;
301 309
     }
302 310
 
@@ -439,8 +447,9 @@  discard block
 block discarded – undo
439 447
     public function getPathWithoutControllerAction(): ?string
440 448
     {
441 449
         $path = trim($this->getPathInfo(), '/');
442
-        if ($this->aliasPathTarget !== null)
443
-            $path = trim($this->aliasPathTarget, '/');
450
+        if ($this->aliasPathTarget !== null) {
451
+                    $path = trim($this->aliasPathTarget, '/');
452
+        }
444 453
 
445 454
         $pathArray = explode('/', $path);
446 455
         if ($pathArray[0] === Str::lowerCase($this->getController())) {
Please login to merge, or discard this patch.
src/Ffcms/Core/App.php 3 patches
Unused Use Statements   -4 removed lines patch added patch discarded remove patch
@@ -6,15 +6,11 @@
 block discarded – undo
6 6
 use Ffcms\Core\Cache\MemoryObject;
7 7
 use Ffcms\Core\Debug\DebugMeasure;
8 8
 use Ffcms\Core\Debug\Manager as Debug;
9
-use Ffcms\Core\Exception\ForbiddenException;
10
-use Ffcms\Core\Exception\JsonException;
11 9
 use Ffcms\Core\Exception\NativeException;
12 10
 use Ffcms\Core\Exception\NotFoundException;
13
-use Ffcms\Core\Exception\SyntaxException;
14 11
 use Ffcms\Core\Exception\TemplateException;
15 12
 use Ffcms\Core\Helper\Security;
16 13
 use Ffcms\Core\Helper\Type\Any;
17
-use Ffcms\Core\Helper\Type\Obj;
18 14
 use Ffcms\Core\Helper\Type\Str;
19 15
 use Ffcms\Core\I18n\Translate;
20 16
 use Ffcms\Core\Managers\BootManager;
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -185,22 +185,22 @@  discard block
 block discarded – undo
185 185
         $html = null;
186 186
         // lets try to get html full content to page render
187 187
         try {
188
-            $this->startMeasure(__METHOD__ . '::callback');
188
+            $this->startMeasure(__METHOD__.'::callback');
189 189
             /** @var \Ffcms\Core\Arch\Controller $callClass */
190 190
             $callClass = null;
191
-            $callMethod = 'action' . self::$Request->getAction();
191
+            $callMethod = 'action'.self::$Request->getAction();
192 192
 
193 193
             // define callback class namespace/name full path
194
-            $cName = (self::$Request->getCallbackAlias() ?? '\Apps\Controller\\' . env_name . '\\' . self::$Request->getController());
194
+            $cName = (self::$Request->getCallbackAlias() ?? '\Apps\Controller\\'.env_name.'\\'.self::$Request->getController());
195 195
             if (!class_exists($cName))
196
-                throw new NotFoundException('Callback class not found: ' . App::$Security->strip_tags($cName));
196
+                throw new NotFoundException('Callback class not found: '.App::$Security->strip_tags($cName));
197 197
 
198 198
             $callClass = new $cName;
199 199
             // check if callback method (action) is exist in class object
200 200
             if (!method_exists($callClass, $callMethod))
201
-                throw new NotFoundException('Method "' . App::$Security->strip_tags($callMethod) . '()" not founded in "' . get_class($callClass) . '"');
201
+                throw new NotFoundException('Method "'.App::$Security->strip_tags($callMethod).'()" not founded in "'.get_class($callClass).'"');
202 202
 
203
-            $this->stopMeasure(__METHOD__ . '::callback');
203
+            $this->stopMeasure(__METHOD__.'::callback');
204 204
             $params = [];
205 205
             if (!Str::likeEmpty(self::$Request->getID())) {
206 206
                 $params[] = self::$Request->getID();
@@ -224,10 +224,10 @@  discard block
 block discarded – undo
224 224
                     'current' => count($params)
225 225
                 ]));
226 226
 
227
-            $this->startMeasure($cName . '::' . $callMethod);
227
+            $this->startMeasure($cName.'::'.$callMethod);
228 228
             // make callback call to action in controller and get response
229 229
             $actionResponse = call_user_func_array([$callClass, $callMethod], $params);
230
-            $this->stopMeasure($cName . '::' . $callMethod);
230
+            $this->stopMeasure($cName.'::'.$callMethod);
231 231
 
232 232
             // set response to controller attribute
233 233
             if (!Str::likeEmpty($actionResponse))
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
                 $html = $e->display();
242 242
             } else { // or hook exception to system based :)))
243 243
                 if (App::$Debug) {
244
-                    $msg = $e->getMessage() . $e->getTraceAsString();
244
+                    $msg = $e->getMessage().$e->getTraceAsString();
245 245
                     $html = (new NativeException($msg))->display();
246 246
                 } else {
247 247
                     $html = (new NativeException($e->getMessage()))->display();
Please login to merge, or discard this patch.
Braces   +21 added lines, -14 removed lines patch added patch discarded remove patch
@@ -156,8 +156,9 @@  discard block
 block discarded – undo
156 156
 
157 157
         /** @var array $objects */
158 158
         $objects = App::$Properties->getAll('object');
159
-        if (!Any::isArray($objects))
160
-            throw new NativeException('Object configurations is not loaded: /Private/Config/Object.php');
159
+        if (!Any::isArray($objects)) {
160
+                    throw new NativeException('Object configurations is not loaded: /Private/Config/Object.php');
161
+        }
161 162
 
162 163
         // each all objects as service_name => service_instance()
163 164
         foreach ($objects as $name => $instance) {
@@ -192,20 +193,23 @@  discard block
 block discarded – undo
192 193
 
193 194
             // define callback class namespace/name full path
194 195
             $cName = (self::$Request->getCallbackAlias() ?? '\Apps\Controller\\' . env_name . '\\' . self::$Request->getController());
195
-            if (!class_exists($cName))
196
-                throw new NotFoundException('Callback class not found: ' . App::$Security->strip_tags($cName));
196
+            if (!class_exists($cName)) {
197
+                            throw new NotFoundException('Callback class not found: ' . App::$Security->strip_tags($cName));
198
+            }
197 199
 
198 200
             $callClass = new $cName;
199 201
             // check if callback method (action) is exist in class object
200
-            if (!method_exists($callClass, $callMethod))
201
-                throw new NotFoundException('Method "' . App::$Security->strip_tags($callMethod) . '()" not founded in "' . get_class($callClass) . '"');
202
+            if (!method_exists($callClass, $callMethod)) {
203
+                            throw new NotFoundException('Method "' . App::$Security->strip_tags($callMethod) . '()" not founded in "' . get_class($callClass) . '"');
204
+            }
202 205
 
203 206
             $this->stopMeasure(__METHOD__ . '::callback');
204 207
             $params = [];
205 208
             if (!Str::likeEmpty(self::$Request->getID())) {
206 209
                 $params[] = self::$Request->getID();
207
-                if (!Str::likeEmpty(self::$Request->getAdd()))
208
-                    $params[] = self::$Request->getAdd();
210
+                if (!Str::likeEmpty(self::$Request->getAdd())) {
211
+                                    $params[] = self::$Request->getAdd();
212
+                }
209 213
             }
210 214
 
211 215
             // get instance of callback object (class::method) as reflection
@@ -213,16 +217,18 @@  discard block
 block discarded – undo
213 217
             $argCount = 0;
214 218
             // calculate method defined arguments count
215 219
             foreach ($instance->getParameters() as $arg) {
216
-                if (!$arg->isOptional())
217
-                    $argCount++;
220
+                if (!$arg->isOptional()) {
221
+                                    $argCount++;
222
+                }
218 223
             }
219 224
             // compare method arg count with passed
220
-            if (count($params) < $argCount)
221
-                throw new NotFoundException(__('Arguments for method %method% is not enough. Expected: %required%, got: %current%.', [
225
+            if (count($params) < $argCount) {
226
+                            throw new NotFoundException(__('Arguments for method %method% is not enough. Expected: %required%, got: %current%.', [
222 227
                     'method' => $callMethod,
223 228
                     'required' => $argCount,
224 229
                     'current' => count($params)
225 230
                 ]));
231
+            }
226 232
 
227 233
             $this->startMeasure($cName . '::' . $callMethod);
228 234
             // make callback call to action in controller and get response
@@ -230,8 +236,9 @@  discard block
 block discarded – undo
230 236
             $this->stopMeasure($cName . '::' . $callMethod);
231 237
 
232 238
             // set response to controller attribute
233
-            if (!Str::likeEmpty($actionResponse))
234
-                $callClass->setOutput($actionResponse);
239
+            if (!Str::likeEmpty($actionResponse)) {
240
+                            $callClass->setOutput($actionResponse);
241
+            }
235 242
 
236 243
             // build full compiled output html data with default layout and widgets
237 244
             $html = $callClass->buildOutput();
Please login to merge, or discard this patch.
src/Ffcms/Core/Arch/View.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -249,7 +249,7 @@
 block discarded – undo
249 249
     /**
250 250
      * Show custom code library link
251 251
      * @param string $type - js or css allowed
252
-     * @return array|null|string
252
+     * @return null|string
253 253
      */
254 254
     public function showCodeLink(string $type)
255 255
     {
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,6 @@
 block discarded – undo
9 9
 use Ffcms\Core\Helper\FileSystem\File;
10 10
 use Ffcms\Core\Helper\FileSystem\Normalize;
11 11
 use Ffcms\Core\Helper\Type\Any;
12
-use Ffcms\Core\Helper\Type\Obj;
13 12
 use Ffcms\Core\Helper\Type\Str;
14 13
 use Ffcms\Core\Template\Variables;
15 14
 use Ffcms\Core\Traits\DynamicGlobal;
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -55,16 +55,16 @@  discard block
 block discarded – undo
55 55
         $this->lang = App::$Request->getLanguage();
56 56
         // get theme config and build full path
57 57
         $themeConfig = App::$Properties->get('theme');
58
-        $this->themePath = root . DIRECTORY_SEPARATOR . 'Apps' . DIRECTORY_SEPARATOR . 'View' . DIRECTORY_SEPARATOR . env_name;
58
+        $this->themePath = root.DIRECTORY_SEPARATOR.'Apps'.DIRECTORY_SEPARATOR.'View'.DIRECTORY_SEPARATOR.env_name;
59 59
         if (isset($themeConfig[env_name]) && Str::length($themeConfig[env_name]) > 0) {
60
-            $this->themePath .=  DIRECTORY_SEPARATOR . $themeConfig[env_name];
60
+            $this->themePath .= DIRECTORY_SEPARATOR.$themeConfig[env_name];
61 61
         } else {
62
-            $this->themePath .= DIRECTORY_SEPARATOR . 'default';
62
+            $this->themePath .= DIRECTORY_SEPARATOR.'default';
63 63
         }
64 64
 
65 65
         // check if theme is available
66 66
         if (!Directory::exist($this->themePath))
67
-            throw new NativeException('Apps theme is not founded: ' . Str::replace(root, null, $this->themePath));
67
+            throw new NativeException('Apps theme is not founded: '.Str::replace(root, null, $this->themePath));
68 68
 
69 69
         // get input args and build class properties
70 70
         $args = func_get_args();
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         
103 103
         // path still not defined?
104 104
         if (!$path)
105
-            throw new SyntaxException('View not found: ' . App::$Security->strip_tags($path));
105
+            throw new SyntaxException('View not found: '.App::$Security->strip_tags($path));
106 106
 
107 107
         // cleanup from slashes on start/end
108 108
         $path = trim($path, '/\\');
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
             // lets try to get full path for current theme
131 131
             $tmpPath = $path;
132 132
             if (!Str::startsWith($this->themePath, $path))
133
-                $tmpPath = Normalize::diskPath($this->themePath . '/' . $path . '.php');
133
+                $tmpPath = Normalize::diskPath($this->themePath.'/'.$path.'.php');
134 134
         } else { // sounds like a object-depended view call from controller or etc
135 135
             // get stack trace of callbacks
136 136
             $calledLog = debug_backtrace();
@@ -144,13 +144,13 @@  discard block
 block discarded – undo
144 144
 
145 145
             // depended controller is not founded? Let finish
146 146
             if (!$calledController)
147
-                throw new SyntaxException('View render is failed: callback controller not founded! Call with relative path: ' . $path);
147
+                throw new SyntaxException('View render is failed: callback controller not founded! Call with relative path: '.$path);
148 148
 
149 149
             // get controller name
150
-            $controllerName = Str::sub($calledController, Str::length('Apps\Controller\\' . env_name . '\\'));
150
+            $controllerName = Str::sub($calledController, Str::length('Apps\Controller\\'.env_name.'\\'));
151 151
             $controllerName = Str::lowerCase($controllerName);
152 152
             // get full path
153
-            $tmpPath = $this->themePath . DIRECTORY_SEPARATOR . $controllerName . DIRECTORY_SEPARATOR . $path . '.php';
153
+            $tmpPath = $this->themePath.DIRECTORY_SEPARATOR.$controllerName.DIRECTORY_SEPARATOR.$path.'.php';
154 154
         }
155 155
 
156 156
         // check if builded view full path is exist
@@ -159,18 +159,18 @@  discard block
 block discarded – undo
159 159
 
160 160
         // hmm, not founded. Lets try to find in caller directory (for widgets, apps packages and other)
161 161
         if ($source !== null) {
162
-            $tmpPath = Normalize::diskPath($source . DIRECTORY_SEPARATOR . $path . '.php');
162
+            $tmpPath = Normalize::diskPath($source.DIRECTORY_SEPARATOR.$path.'.php');
163 163
             if (File::exist($tmpPath)) {
164 164
                 // add notify for native views
165 165
                 if (App::$Debug)
166
-                    App::$Debug->addMessage('Render native viewer: ' . Str::replace(root, null, $tmpPath), 'info');
166
+                    App::$Debug->addMessage('Render native viewer: '.Str::replace(root, null, $tmpPath), 'info');
167 167
 
168 168
                 return $tmpPath;
169 169
             }
170 170
         }
171 171
 
172 172
         if (App::$Debug)
173
-            App::$Debug->addMessage('Viewer not founded on rendering: ' . $path, 'warning');
173
+            App::$Debug->addMessage('Viewer not founded on rendering: '.$path, 'warning');
174 174
 
175 175
         return null;
176 176
     }
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
         foreach ($items as $item) {
263 263
             $item = trim($item, '/');
264 264
             if (!Str::startsWith(App::$Alias->scriptUrl, $item) && !Str::startsWith('http', $item)) { // is local without proto and domain
265
-                $item = App::$Alias->scriptUrl . '/' . $item;
265
+                $item = App::$Alias->scriptUrl.'/'.$item;
266 266
             }
267 267
             $output[] = $item;
268 268
         }
@@ -271,9 +271,9 @@  discard block
 block discarded – undo
271 271
         $output = null;
272 272
         foreach ($clear as $row) {
273 273
             if ($type === 'css') {
274
-                $output .= '<link rel="stylesheet" type="text/css" href="' . $row . '">' . "\n";
274
+                $output .= '<link rel="stylesheet" type="text/css" href="'.$row.'">'."\n";
275 275
             } elseif ($type === 'js') {
276
-                $output .= '<script src="' . $row . '"></script>' . "\n";
276
+                $output .= '<script src="'.$row.'"></script>'."\n";
277 277
             }
278 278
         }
279 279
 
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 
296 296
         $code = null;
297 297
         foreach (App::$Alias->getPlainCode($type) as $row) {
298
-            $code .= $row . "\n";
298
+            $code .= $row."\n";
299 299
         }
300 300
 
301 301
         return $code;
Please login to merge, or discard this patch.
Braces   +45 added lines, -30 removed lines patch added patch discarded remove patch
@@ -63,8 +63,9 @@  discard block
 block discarded – undo
63 63
         }
64 64
 
65 65
         // check if theme is available
66
-        if (!Directory::exist($this->themePath))
67
-            throw new NativeException('Apps theme is not founded: ' . Str::replace(root, null, $this->themePath));
66
+        if (!Directory::exist($this->themePath)) {
67
+                    throw new NativeException('Apps theme is not founded: ' . Str::replace(root, null, $this->themePath));
68
+        }
68 69
 
69 70
         // get input args and build class properties
70 71
         $args = func_get_args();
@@ -89,20 +90,24 @@  discard block
 block discarded – undo
89 90
         $source = $this->sourcePath;
90 91
 
91 92
         // if path is not defined - try to find it in arguments
92
-        if (!$path)
93
-            $path = array_shift($arguments);
93
+        if (!$path) {
94
+                    $path = array_shift($arguments);
95
+        }
94 96
 
95 97
         // if arguments is not define - try to find in arguments
96
-        if (!$params)
97
-            $params = array_shift($arguments);
98
+        if (!$params) {
99
+                    $params = array_shift($arguments);
100
+        }
98 101
 
99 102
         // if directory of caller is not defiend - lets find in argument
100
-        if (!$source)
101
-            $source = array_shift($arguments);
103
+        if (!$source) {
104
+                    $source = array_shift($arguments);
105
+        }
102 106
         
103 107
         // path still not defined?
104
-        if (!$path)
105
-            throw new SyntaxException('View not found: ' . App::$Security->strip_tags($path));
108
+        if (!$path) {
109
+                    throw new SyntaxException('View not found: ' . App::$Security->strip_tags($path));
110
+        }
106 111
 
107 112
         // cleanup from slashes on start/end
108 113
         $path = trim($path, '/\\');
@@ -129,8 +134,9 @@  discard block
 block discarded – undo
129 134
         if (Str::contains('/', $path)) {
130 135
             // lets try to get full path for current theme
131 136
             $tmpPath = $path;
132
-            if (!Str::startsWith($this->themePath, $path))
133
-                $tmpPath = Normalize::diskPath($this->themePath . '/' . $path . '.php');
137
+            if (!Str::startsWith($this->themePath, $path)) {
138
+                            $tmpPath = Normalize::diskPath($this->themePath . '/' . $path . '.php');
139
+            }
134 140
         } else { // sounds like a object-depended view call from controller or etc
135 141
             // get stack trace of callbacks
136 142
             $calledLog = debug_backtrace();
@@ -138,13 +144,15 @@  discard block
 block discarded – undo
138 144
 
139 145
             // lets try to find controller in backtrace
140 146
             foreach ($calledLog as $caller) {
141
-                if (isset($caller['class']) && Str::startsWith('Apps\Controller\\', $caller['class']))
142
-                    $calledController = (string)$caller['class'];
147
+                if (isset($caller['class']) && Str::startsWith('Apps\Controller\\', $caller['class'])) {
148
+                                    $calledController = (string)$caller['class'];
149
+                }
143 150
             }
144 151
 
145 152
             // depended controller is not founded? Let finish
146
-            if (!$calledController)
147
-                throw new SyntaxException('View render is failed: callback controller not founded! Call with relative path: ' . $path);
153
+            if (!$calledController) {
154
+                            throw new SyntaxException('View render is failed: callback controller not founded! Call with relative path: ' . $path);
155
+            }
148 156
 
149 157
             // get controller name
150 158
             $controllerName = Str::sub($calledController, Str::length('Apps\Controller\\' . env_name . '\\'));
@@ -154,23 +162,26 @@  discard block
 block discarded – undo
154 162
         }
155 163
 
156 164
         // check if builded view full path is exist
157
-        if (File::exist($tmpPath))
158
-            return $tmpPath;
165
+        if (File::exist($tmpPath)) {
166
+                    return $tmpPath;
167
+        }
159 168
 
160 169
         // hmm, not founded. Lets try to find in caller directory (for widgets, apps packages and other)
161 170
         if ($source !== null) {
162 171
             $tmpPath = Normalize::diskPath($source . DIRECTORY_SEPARATOR . $path . '.php');
163 172
             if (File::exist($tmpPath)) {
164 173
                 // add notify for native views
165
-                if (App::$Debug)
166
-                    App::$Debug->addMessage('Render native viewer: ' . Str::replace(root, null, $tmpPath), 'info');
174
+                if (App::$Debug) {
175
+                                    App::$Debug->addMessage('Render native viewer: ' . Str::replace(root, null, $tmpPath), 'info');
176
+                }
167 177
 
168 178
                 return $tmpPath;
169 179
             }
170 180
         }
171 181
 
172
-        if (App::$Debug)
173
-            App::$Debug->addMessage('Viewer not founded on rendering: ' . $path, 'warning');
182
+        if (App::$Debug) {
183
+                    App::$Debug->addMessage('Viewer not founded on rendering: ' . $path, 'warning');
184
+        }
174 185
 
175 186
         return null;
176 187
     }
@@ -193,8 +204,9 @@  discard block
 block discarded – undo
193 204
      */
194 205
     protected function renderSandbox($path, $params = null)
195 206
     {
196
-        if (!$path || !File::exist($path))
197
-            return null;
207
+        if (!$path || !File::exist($path)) {
208
+                    return null;
209
+        }
198 210
 
199 211
         // render defaults params as variables
200 212
         if (Any::isArray($params) && count($params) > 0) {
@@ -218,8 +230,9 @@  discard block
 block discarded – undo
218 230
             ob_end_clean();
219 231
             // prepare output message
220 232
             $msg = $e->getMessage();
221
-            if (!Str::likeEmpty($msg))
222
-                $msg .= '. ';
233
+            if (!Str::likeEmpty($msg)) {
234
+                            $msg .= '. ';
235
+            }
223 236
 
224 237
             $msg .= __('Native exception catched in view: %path% in line %line%', ['path' => $path, 'line' => $e->getLine()]);
225 238
             exit($e->display($msg));
@@ -255,8 +268,9 @@  discard block
 block discarded – undo
255 268
     {
256 269
         $items = App::$Alias->getCustomLibraryArray($type);
257 270
         // check if custom library available
258
-        if (!$items || !Any::isArray($items) || count($items) < 1)
259
-            return null;
271
+        if (!$items || !Any::isArray($items) || count($items) < 1) {
272
+                    return null;
273
+        }
260 274
 
261 275
         $output = [];
262 276
         foreach ($items as $item) {
@@ -290,8 +304,9 @@  discard block
 block discarded – undo
290 304
      */
291 305
     public function showPlainCode(?string $type = null): ?string
292 306
     {
293
-        if (!App::$Alias->getPlainCode($type) || !Any::isArray(App::$Alias->getPlainCode($type)))
294
-            return null;
307
+        if (!App::$Alias->getPlainCode($type) || !Any::isArray(App::$Alias->getPlainCode($type))) {
308
+                    return null;
309
+        }
295 310
 
296 311
         $code = null;
297 312
         foreach (App::$Alias->getPlainCode($type) as $row) {
Please login to merge, or discard this patch.
src/Ffcms/Core/Debug/Manager.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,6 @@
 block discarded – undo
8 8
 use DebugBar\StandardDebugBar;
9 9
 use Ffcms\Core\App;
10 10
 use Ffcms\Core\Helper\Type\Any;
11
-use Ffcms\Core\Helper\Type\Obj;
12 11
 
13 12
 /**
14 13
  * Class Debug. Provide methods of display information about debug and collected data in debug bar
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
         $this->render = $this->bar->getJavascriptRenderer();
30 30
         try {
31 31
             $this->bar->addCollector(new ConfigCollector());
32
-        } catch (\Exception $oe){}
32
+        } catch (\Exception $oe) {}
33 33
     }
34 34
 
35 35
     /**
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -80,8 +80,9 @@
 block discarded – undo
80 80
      */
81 81
     public function addMessage($m, $type = 'info')
82 82
     {
83
-        if (!Any::isStr($m) || !Any::isStr($type))
84
-            return;
83
+        if (!Any::isStr($m) || !Any::isStr($type)) {
84
+                    return;
85
+        }
85 86
 
86 87
         $m = App::$Security->secureHtml($m);
87 88
         try {
Please login to merge, or discard this patch.
src/Ffcms/Core/Helper/HTML/Bootstrap/Nav.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,6 @@
 block discarded – undo
7 7
 use Ffcms\Core\Helper\HTML\System\NativeGenerator;
8 8
 use Ffcms\Core\Helper\Type\Any;
9 9
 use Ffcms\Core\Helper\Type\Arr;
10
-use Ffcms\Core\Helper\Type\Obj;
11 10
 use Ffcms\Core\Helper\Type\Str;
12 11
 
13 12
 class Nav extends NativeGenerator
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
             } elseif ($item['type'] === 'tab') {
60 60
                 $activeObject = false;
61 61
                 $item['type'] = 'link'; // fix for global Listing builder
62
-                $item['link'] = '#' . $elements['tabAnchor'] . $tabIdx;
62
+                $item['link'] = '#'.$elements['tabAnchor'].$tabIdx;
63 63
 
64 64
                 $item['property']['role'] = 'presentation';
65 65
 
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
 
75 75
                 // mark active tab
76 76
                 if ($activeObject === true)
77
-                    $item['property']['class'] .= (Str::length($item['property']['class']) > 0 ? ' ' : null) . 'active';
77
+                    $item['property']['class'] .= (Str::length($item['property']['class']) > 0 ? ' ' : null).'active';
78 78
 
79 79
                 // tab special properties for bootstrap
80
-                $item['linkProperty']['aria-controls'] = $elements['tabAnchor'] . $tabIdx;
80
+                $item['linkProperty']['aria-controls'] = $elements['tabAnchor'].$tabIdx;
81 81
                 $item['linkProperty']['role'] = 'tab';
82 82
                 $item['linkProperty']['data-toggle'] = 'tab';
83 83
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
                     } else {
97 97
                         return self::nohtml($itemContent);
98 98
                     }
99
-                }, ['role' => 'tabpanel', 'class' => 'tab-pane fade' . ($activeObject === true ? ' in active' : null), 'id' => $elements['tabAnchor'] . $tabIdx]);
99
+                }, ['role' => 'tabpanel', 'class' => 'tab-pane fade'.($activeObject === true ? ' in active' : null), 'id' => $elements['tabAnchor'].$tabIdx]);
100 100
                 $tabIdx++;
101 101
             }
102 102
         }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         // check if global class "nav" isset
105 105
         if ($elements['property']['class'] !== null) {
106 106
             if (!Str::contains('nav ', $elements['property']['class'])) {
107
-                $elements['property']['class'] = 'nav ' . $elements['property']['class'];
107
+                $elements['property']['class'] = 'nav '.$elements['property']['class'];
108 108
             }
109 109
         } else {
110 110
             $elements['property']['class'] = 'nav';
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
                     return $tabContent;
129 129
                 }, $elements['tabProperty']);
130 130
             }
131
-            return $listing . $tabContent;
131
+            return $listing.$tabContent;
132 132
         }, $blockProperty);
133 133
     }
134 134
 }
135 135
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -20,18 +20,21 @@  discard block
 block discarded – undo
20 20
     public static function display(array $elements): ?string
21 21
     {
22 22
         // check if elements isn't empty and contains rows
23
-        if (!isset($elements['items']) || count($elements['items']) < 1)
24
-            return null;
23
+        if (!isset($elements['items']) || count($elements['items']) < 1) {
24
+                    return null;
25
+        }
25 26
 
26 27
         // prepare tab order
27
-        if ($elements['tabAnchor'] === null)
28
-            $elements['tabAnchor'] = Str::randomLatin(mt_rand(6, 12));
28
+        if ($elements['tabAnchor'] === null) {
29
+                    $elements['tabAnchor'] = Str::randomLatin(mt_rand(6, 12));
30
+        }
29 31
 
30 32
         // set global element properties
31 33
         $blockProperty = [];
32 34
         if ($elements['blockProperty'] !== null) {
33
-            if (Any::isArray($elements['blockProperty']))
34
-                $blockProperty = $elements['blockProperty'];
35
+            if (Any::isArray($elements['blockProperty'])) {
36
+                            $blockProperty = $elements['blockProperty'];
37
+            }
35 38
             unset($elements['blockProperty']);
36 39
         }
37 40
 
@@ -73,8 +76,9 @@  discard block
 block discarded – undo
73 76
                 }
74 77
 
75 78
                 // mark active tab
76
-                if ($activeObject === true)
77
-                    $item['property']['class'] .= (Str::length($item['property']['class']) > 0 ? ' ' : null) . 'active';
79
+                if ($activeObject === true) {
80
+                                    $item['property']['class'] .= (Str::length($item['property']['class']) > 0 ? ' ' : null) . 'active';
81
+                }
78 82
 
79 83
                 // tab special properties for bootstrap
80 84
                 $item['linkProperty']['aria-controls'] = $elements['tabAnchor'] . $tabIdx;
Please login to merge, or discard this patch.
src/Ffcms/Core/Helper/HTML/Form.php 3 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -4,14 +4,12 @@
 block discarded – undo
4 4
 
5 5
 use Ffcms\Core\App;
6 6
 use Ffcms\Core\Arch\Model;
7
-use Ffcms\Core\Exception\NativeException;
8 7
 use Ffcms\Core\Exception\SyntaxException;
9 8
 use Ffcms\Core\Helper\FileSystem\File;
10 9
 use Ffcms\Core\Helper\HTML\Form\Constructor;
11 10
 use Ffcms\Core\Helper\HTML\System\NativeGenerator;
12 11
 use Ffcms\Core\Helper\Type\Any;
13 12
 use Ffcms\Core\Helper\Type\Arr;
14
-use Ffcms\Core\Helper\Type\Obj;
15 13
 use Ffcms\Core\Helper\Type\Str;
16 14
 
17 15
 /**
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     {
80 80
         $form = self::buildSingleTag('form', $this->formProperty, false);
81 81
         if ($this->model->_tokenRequired) {
82
-            $form .= PHP_EOL . $this->field('_csrf_token', 'hidden', ['value' => $this->model->_csrf_token]);
82
+            $form .= PHP_EOL.$this->field('_csrf_token', 'hidden', ['value' => $this->model->_csrf_token]);
83 83
         }
84 84
         return $form;
85 85
     }
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     {
98 98
         if ($this->model === null) {
99 99
             if (App::$Debug)
100
-                App::$Debug->addMessage('Form model is not defined for field name: [' . strip_tags($object) . ']');
100
+                App::$Debug->addMessage('Form model is not defined for field name: ['.strip_tags($object).']');
101 101
 
102 102
             return null;
103 103
         }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         // check if model contains current tag name as property
111 111
         if (!property_exists($this->model, $propertyName)) {
112 112
             if (App::$Debug)
113
-                App::$Debug->addMessage('Form field ["' . $object . '"] is not defined in model: [' . get_class($this->model) . ']', 'error');
113
+                App::$Debug->addMessage('Form field ["'.$object.'"] is not defined in model: ['.get_class($this->model).']', 'error');
114 114
 
115 115
             return null;
116 116
         }
@@ -131,13 +131,13 @@  discard block
 block discarded – undo
131 131
         }
132 132
         
133 133
         // prepare labels text and label "for" attr 
134
-        $labelFor = $this->name . '-' . $propertyName;
134
+        $labelFor = $this->name.'-'.$propertyName;
135 135
         $labelText = $this->model->getLabel($object);
136 136
         $itemValue = $this->model->{$propertyName};
137 137
         // sounds like a dot-separated $object
138 138
         if ($propertyName !== $object) {
139 139
             $nesting = trim(strstr($object, '.'), '.');
140
-            $labelFor .= '-' . Str::replace('.', '-', $nesting);
140
+            $labelFor .= '-'.Str::replace('.', '-', $nesting);
141 141
             $itemValue = Arr::getByPath($nesting, $itemValue);
142 142
         }
143 143
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
     public function submitButton($title, array $property = [])
179 179
     {
180 180
         $property['type'] = 'submit';
181
-        $property['name'] = $this->name . '[submit]';
181
+        $property['name'] = $this->name.'[submit]';
182 182
         $property['value'] = $title;
183 183
         return self::buildSingleTag('input', $property);
184 184
     }
@@ -192,10 +192,10 @@  discard block
 block discarded – undo
192 192
     {
193 193
         // pre-validate form fields based on model rules and jquery.validation
194 194
         if ($validate) {
195
-            App::$Alias->addPlainCode('js', '$().ready(function() { $("#' . $this->name . '").validate(); });');
195
+            App::$Alias->addPlainCode('js', '$().ready(function() { $("#'.$this->name.'").validate(); });');
196 196
             App::$Alias->setCustomLibrary('js', '/vendor/bower/jquery-validation/dist/jquery.validate.min.js');
197 197
             if (App::$Request->getLanguage() !== 'en') {
198
-                $localeFile = '/vendor/bower/jquery-validation/src/localization/messages_' . App::$Request->getLanguage() . '.js';
198
+                $localeFile = '/vendor/bower/jquery-validation/src/localization/messages_'.App::$Request->getLanguage().'.js';
199 199
                 if (File::exist($localeFile)) {
200 200
                     App::$Alias->setCustomLibrary('js', $localeFile);
201 201
                 }
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
                 $formName = $this->model->getFormName();
207 207
                 if (Any::isArray($badAttr) && count($badAttr) > 0) {
208 208
                     foreach ($badAttr as $attr) {
209
-                        $itemId = $formName . '-' . $attr;
209
+                        $itemId = $formName.'-'.$attr;
210 210
                         try {
211 211
                             $render = App::$View->render(static::$structLayer['jsnotify'], ['itemId' => $itemId]);
212 212
                             App::$Alias->addPlainCode('js', $render);
Please login to merge, or discard this patch.
Braces   +24 added lines, -16 removed lines patch added patch discarded remove patch
@@ -46,8 +46,9 @@  discard block
 block discarded – undo
46 46
     public function __construct($model, array $property = null, array $layerFiles = null)
47 47
     {
48 48
         // prevent white-screen locks when model is not passed or passed wrong
49
-        if (!$model instanceof Model)
50
-            throw new SyntaxException('Bad model type passed in form builder. Check for init: new Form()');
49
+        if (!$model instanceof Model) {
50
+                    throw new SyntaxException('Bad model type passed in form builder. Check for init: new Form()');
51
+        }
51 52
 
52 53
         $this->model = $model;
53 54
         $this->name = $model->getFormName();
@@ -55,8 +56,9 @@  discard block
 block discarded – undo
55 56
         // check if passed custom layer file
56 57
         if (Any::isArray($layerFiles) && count($layerFiles) > 0) {
57 58
             foreach (array_keys(static::$structLayer) as $type) {
58
-                if (isset($layerFiles[$type]) && Any::isStr($layerFiles[$type]))
59
-                    static::$structLayer[$type] = $layerFiles[$type];
59
+                if (isset($layerFiles[$type]) && Any::isStr($layerFiles[$type])) {
60
+                                    static::$structLayer[$type] = $layerFiles[$type];
61
+                }
60 62
             }
61 63
         }
62 64
         // set model submit method
@@ -64,8 +66,9 @@  discard block
 block discarded – undo
64 66
 
65 67
         $property['id'] = $this->name; // define form id
66 68
         // if action is not defined - define it
67
-        if (!$property['action'])
68
-            $property['action'] = App::$Request->getFullUrl();
69
+        if (!$property['action']) {
70
+                    $property['action'] = App::$Request->getFullUrl();
71
+        }
69 72
 
70 73
         // set property global for this form
71 74
         $this->formProperty = $property;
@@ -96,21 +99,24 @@  discard block
 block discarded – undo
96 99
     public function field(string $object, string $type, ?array $property = null, ?string $helper = null, ?string $layerFile = null)
97 100
     {
98 101
         if ($this->model === null) {
99
-            if (App::$Debug)
100
-                App::$Debug->addMessage('Form model is not defined for field name: [' . strip_tags($object) . ']');
102
+            if (App::$Debug) {
103
+                            App::$Debug->addMessage('Form model is not defined for field name: [' . strip_tags($object) . ']');
104
+            }
101 105
 
102 106
             return null;
103 107
         }
104 108
 
105 109
         // can be dots separated object
106 110
         $propertyName = $object;
107
-        if (Str::contains('.', $propertyName))
108
-            $propertyName = strstr($propertyName, '.', true);
111
+        if (Str::contains('.', $propertyName)) {
112
+                    $propertyName = strstr($propertyName, '.', true);
113
+        }
109 114
 
110 115
         // check if model contains current tag name as property
111 116
         if (!property_exists($this->model, $propertyName)) {
112
-            if (App::$Debug)
113
-                App::$Debug->addMessage('Form field ["' . $object . '"] is not defined in model: [' . get_class($this->model) . ']', 'error');
117
+            if (App::$Debug) {
118
+                            App::$Debug->addMessage('Form field ["' . $object . '"] is not defined in model: [' . get_class($this->model) . ']', 'error');
119
+            }
114 120
 
115 121
             return null;
116 122
         }
@@ -159,8 +165,9 @@  discard block
 block discarded – undo
159 165
                 'help' => self::nohtml($helper)
160 166
             ]);
161 167
         } catch (SyntaxException $e) {
162
-            if (App::$Debug)
163
-                App::$Debug->addException($e);
168
+            if (App::$Debug) {
169
+                            App::$Debug->addException($e);
170
+            }
164 171
 
165 172
             $response = null;
166 173
         }
@@ -211,8 +218,9 @@  discard block
 block discarded – undo
211 218
                             $render = App::$View->render(static::$structLayer['jsnotify'], ['itemId' => $itemId]);
212 219
                             App::$Alias->addPlainCode('js', $render);
213 220
                         } catch (SyntaxException $e) {
214
-                            if (App::$Debug)
215
-                                App::$Debug->addException($e);
221
+                            if (App::$Debug) {
222
+                                                            App::$Debug->addException($e);
223
+                            }
216 224
                         }
217 225
                     }
218 226
                 }
Please login to merge, or discard this patch.