@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | /** |
| 42 | 42 | * Get label value by variable name |
| 43 | 43 | * @param string $param |
| 44 | - * @return mixed |
|
| 44 | + * @return string |
|
| 45 | 45 | */ |
| 46 | 46 | final public function getLabel($param) |
| 47 | 47 | { |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | 67 | * Set attribute labels for model variables |
| 68 | - * @return array |
|
| 68 | + * @return string |
|
| 69 | 69 | */ |
| 70 | 70 | public function labels(): array |
| 71 | 71 | { |
@@ -156,7 +156,7 @@ |
||
| 156 | 156 | * Get all properties for current model in key=>value array |
| 157 | 157 | * @return array|null |
| 158 | 158 | */ |
| 159 | - public function getAllProperties(): ?array |
|
| 159 | + public function getAllProperties(): ? array |
|
| 160 | 160 | { |
| 161 | 161 | $properties = null; |
| 162 | 162 | // list all properties here, array_walk sucks on performance! |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | // check if cache is enabled |
| 43 | 43 | if (App::$Cache !== null) { |
| 44 | 44 | // try to get bootable class map from cache, or initialize parsing |
| 45 | - $cache = App::$Cache->getItem('boot.' . env_name . '.class.map'); |
|
| 45 | + $cache = App::$Cache->getItem('boot.'.env_name.'.class.map'); |
|
| 46 | 46 | if (!$cache->isHit()) { |
| 47 | 47 | $this->compileBootableClasses(); |
| 48 | 48 | $cache->set($this->objects)->expiresAfter(static::CACHE_TREE_TIME); |
@@ -97,11 +97,11 @@ discard block |
||
| 97 | 97 | { |
| 98 | 98 | // list app root's |
| 99 | 99 | foreach ($this->appRoots as $app) { |
| 100 | - $app .= '/Apps/Controller/' . env_name; |
|
| 100 | + $app .= '/Apps/Controller/'.env_name; |
|
| 101 | 101 | $files = File::listFiles($app, ['.php'], true); |
| 102 | 102 | foreach ($files as $file) { |
| 103 | 103 | // define full class name with namespace |
| 104 | - $class = 'Apps\Controller\\' . env_name . '\\' . Str::cleanExtension($file); |
|
| 104 | + $class = 'Apps\Controller\\'.env_name.'\\'.Str::cleanExtension($file); |
|
| 105 | 105 | // check if class exists (must be loaded over autoloader), boot method exist and this is controller instanceof |
| 106 | 106 | if (class_exists($class) && method_exists($class, 'boot') && is_a($class, 'Ffcms\Core\Arch\Controller', true)) { |
| 107 | 107 | $this->objects[] = $class; |
@@ -111,14 +111,14 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | // list widget root's |
| 113 | 113 | foreach ($this->widgetRoots as $widget) { |
| 114 | - $widget .= '/Widgets/' . env_name; |
|
| 114 | + $widget .= '/Widgets/'.env_name; |
|
| 115 | 115 | // widgets are packed in directory, classname should be the same with root directory name |
| 116 | 116 | $dirs = Directory::scan($widget, GLOB_ONLYDIR, true); |
| 117 | 117 | if (!Obj::isArray($dirs)) { |
| 118 | 118 | continue; |
| 119 | 119 | } |
| 120 | 120 | foreach ($dirs as $instance) { |
| 121 | - $class = 'Widgets\\' . env_name . '\\' . $instance . '\\' . $instance; |
|
| 121 | + $class = 'Widgets\\'.env_name.'\\'.$instance.'\\'.$instance; |
|
| 122 | 122 | if (class_exists($class) && method_exists($class, 'boot') && is_a($class, 'Ffcms\Core\Arch\Widget', true)) { |
| 123 | 123 | $this->objects[] = $class; |
| 124 | 124 | } |
@@ -67,9 +67,9 @@ discard block |
||
| 67 | 67 | } else { |
| 68 | 68 | $this->startMeasure(__METHOD__); |
| 69 | 69 | |
| 70 | - $layoutPath = App::$Alias->currentViewPath . '/layout/' . $this->layout . '.php'; |
|
| 70 | + $layoutPath = App::$Alias->currentViewPath.'/layout/'.$this->layout.'.php'; |
|
| 71 | 71 | if (!File::exist($layoutPath)) { |
| 72 | - throw new NativeException('Layout not founded: ' . $layoutPath); |
|
| 72 | + throw new NativeException('Layout not founded: '.$layoutPath); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | $body = $this->output; |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | // set custom css library's not included on static call |
| 89 | 89 | $cssIncludeCode = App::$View->showCodeLink('css'); |
| 90 | 90 | if (!Str::likeEmpty($cssIncludeCode)) { |
| 91 | - $content = Str::replace('</head>', $cssIncludeCode . '</head>', $content); |
|
| 91 | + $content = Str::replace('</head>', $cssIncludeCode.'</head>', $content); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | if (App::$Debug) { |
| 99 | 99 | $content = Str::replace( |
| 100 | 100 | ['</body>', '</head>'], |
| 101 | - [App::$Debug->renderOut() . '</body>', App::$Debug->renderHead() . '</head>'], |
|
| 101 | + [App::$Debug->renderOut().'</body>', App::$Debug->renderHead().'</head>'], |
|
| 102 | 102 | $content); |
| 103 | 103 | } |
| 104 | 104 | |
@@ -138,7 +138,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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; |
@@ -317,8 +317,9 @@ discard block |
||
| 317 | 317 | */ |
| 318 | 318 | public function getRequest($param, $method = null) |
| 319 | 319 | { |
| 320 | - if ($method === null) |
|
| 321 | - $method = $this->_sendMethod; |
|
| 320 | + if ($method === null) { |
|
| 321 | + $method = $this->_sendMethod; |
|
| 322 | + } |
|
| 322 | 323 | |
| 323 | 324 | $method = Str::lowerCase($method); |
| 324 | 325 | // get root request as array or string |
@@ -342,8 +343,9 @@ discard block |
||
| 342 | 343 | if (Str::contains('.', $param)) { |
| 343 | 344 | $response = $request; |
| 344 | 345 | foreach (explode('.', $param) as $path) { |
| 345 | - if (!array_key_exists($path, $response)) |
|
| 346 | - return null; |
|
| 346 | + if (!array_key_exists($path, $response)) { |
|
| 347 | + return null; |
|
| 348 | + } |
|
| 347 | 349 | // find deep array nesting offset |
| 348 | 350 | $response = $response[$path]; |
| 349 | 351 | } |
@@ -16,8 +16,9 @@ discard block |
||
| 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 |
||
| 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 |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | try { |
| 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 | // founded callback injection alias |
| 194 | 194 | if (self::$Request->getCallbackAlias() !== false) { |
@@ -196,16 +196,16 @@ discard block |
||
| 196 | 196 | if (class_exists($cName)) { |
| 197 | 197 | $callClass = new $cName; |
| 198 | 198 | } else { |
| 199 | - throw new NotFoundException('Callback alias of class "' . App::$Security->strip_tags($cName) . '" is not founded'); |
|
| 199 | + throw new NotFoundException('Callback alias of class "'.App::$Security->strip_tags($cName).'" is not founded'); |
|
| 200 | 200 | } |
| 201 | 201 | } else { // typical parsing of native apps |
| 202 | - $cName = '\Apps\Controller\\' . env_name . '\\' . self::$Request->getController(); |
|
| 202 | + $cName = '\Apps\Controller\\'.env_name.'\\'.self::$Request->getController(); |
|
| 203 | 203 | |
| 204 | 204 | // try to initialize class object |
| 205 | 205 | if (class_exists($cName)) { |
| 206 | 206 | $callClass = new $cName; |
| 207 | 207 | } else { |
| 208 | - throw new NotFoundException('Application can not be runned. Initialized class not founded: ' . App::$Security->strip_tags($cName)); |
|
| 208 | + throw new NotFoundException('Application can not be runned. Initialized class not founded: '.App::$Security->strip_tags($cName)); |
|
| 209 | 209 | } |
| 210 | 210 | } |
| 211 | 211 | |
@@ -238,10 +238,10 @@ discard block |
||
| 238 | 238 | ])); |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - $this->startMeasure($cName . '::' . $callMethod); |
|
| 241 | + $this->startMeasure($cName.'::'.$callMethod); |
|
| 242 | 242 | // make callback call to action in controller and get response |
| 243 | 243 | $actionResponse = call_user_func_array([$callClass, $callMethod], $actionQuery); |
| 244 | - $this->stopMeasure($cName . '::' . $callMethod); |
|
| 244 | + $this->stopMeasure($cName.'::'.$callMethod); |
|
| 245 | 245 | |
| 246 | 246 | if ($actionResponse !== null && !Str::likeEmpty($actionResponse)) { |
| 247 | 247 | // set response to controller property object |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | // build full compiled output html data |
| 252 | 252 | $html = $callClass->buildOutput(); |
| 253 | 253 | } else { |
| 254 | - throw new NotFoundException('Method "' . App::$Security->strip_tags($callMethod) . '()" not founded in "' . get_class($callClass) . '"'); |
|
| 254 | + throw new NotFoundException('Method "'.App::$Security->strip_tags($callMethod).'()" not founded in "'.get_class($callClass).'"'); |
|
| 255 | 255 | } |
| 256 | 256 | } catch (NotFoundException $e) { // catch exceptions and set output |
| 257 | 257 | $html = $e->display(); |