Completed
Push — master ( 48735e...1bc6cd )
by Mihail
02:17
created
src/Helper/Security.php 1 patch
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      * String html tags and escape quotes
47 47
      * @param string|array $html
48 48
      * @param boolean $escapeQuotes
49
-     * @return string|array|null
49
+     * @return string|null
50 50
      */
51 51
     public function strip_tags($html, $escapeQuotes = true)
52 52
     {
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      * @deprecated
88 88
      * @param $var
89 89
      * @param null $indent
90
-     * @return mixed|string
90
+     * @return string|null
91 91
      */
92 92
     public function var_export54($var, $indent = null, $guessTypes = false)
93 93
     {
Please login to merge, or discard this patch.
src/Arch/Controller.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
         } else {
72 72
             $this->startMeasure(__METHOD__);
73 73
 
74
-            $layoutPath = App::$Alias->currentViewPath . '/layout/' . $this->layout . '.php';
74
+            $layoutPath = App::$Alias->currentViewPath.'/layout/'.$this->layout.'.php';
75 75
             if (!File::exist($layoutPath)) {
76
-                throw new NativeException('Layout not founded: ' . $layoutPath);
76
+                throw new NativeException('Layout not founded: '.$layoutPath);
77 77
             }
78 78
 
79 79
             $body = $this->output;
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
             // set custom css library's not included on static call
93 93
             $cssIncludeCode = App::$View->showCodeLink('css');
94 94
             if (!Str::likeEmpty($cssIncludeCode)) {
95
-                $content = Str::replace('</head>', $cssIncludeCode . '</head>', $content);
95
+                $content = Str::replace('</head>', $cssIncludeCode.'</head>', $content);
96 96
             }
97 97
 
98 98
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
             if (App::$Debug) {
103 103
                 $content = Str::replace(
104 104
                     ['</body>', '</head>'],
105
-                    [App::$Debug->renderOut() . '</body>', App::$Debug->renderHead() . '</head>'],
105
+                    [App::$Debug->renderOut().'</body>', App::$Debug->renderHead().'</head>'],
106 106
                     $content
107 107
                 );
108 108
             }
Please login to merge, or discard this patch.
src/Arch/View.php 1 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
 
70 70
         // get input args and build class properties
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         
107 107
         // path still not defined?
108 108
         if (!$path) {
109
-            throw new SyntaxException('View not found: ' . App::$Security->strip_tags($path));
109
+            throw new SyntaxException('View not found: '.App::$Security->strip_tags($path));
110 110
         }
111 111
 
112 112
         // cleanup from slashes on start/end
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
             // lets try to get full path for current theme
136 136
             $tmpPath = $path;
137 137
             if (!Str::startsWith($this->themePath, $path)) {
138
-                $tmpPath = Normalize::diskPath($this->themePath . '/' . $path . '.php');
138
+                $tmpPath = Normalize::diskPath($this->themePath.'/'.$path.'.php');
139 139
             }
140 140
         } else { // sounds like a object-depended view call from controller or etc
141 141
             // get stack trace of callbacks
@@ -151,14 +151,14 @@  discard block
 block discarded – undo
151 151
 
152 152
             // depended controller is not founded? Let finish
153 153
             if (!$calledController) {
154
-                throw new SyntaxException('View render is failed: callback controller not founded! Call with relative path: ' . $path);
154
+                throw new SyntaxException('View render is failed: callback controller not founded! Call with relative path: '.$path);
155 155
             }
156 156
 
157 157
             // get controller name
158
-            $controllerName = Str::sub($calledController, Str::length('Apps\Controller\\' . env_name . '\\'));
158
+            $controllerName = Str::sub($calledController, Str::length('Apps\Controller\\'.env_name.'\\'));
159 159
             $controllerName = Str::lowerCase($controllerName);
160 160
             // get full path
161
-            $tmpPath = $this->themePath . DIRECTORY_SEPARATOR . $controllerName . DIRECTORY_SEPARATOR . $path . '.php';
161
+            $tmpPath = $this->themePath.DIRECTORY_SEPARATOR.$controllerName.DIRECTORY_SEPARATOR.$path.'.php';
162 162
         }
163 163
 
164 164
         // check if builded view full path is exist
@@ -168,11 +168,11 @@  discard block
 block discarded – undo
168 168
 
169 169
         // hmm, not founded. Lets try to find in caller directory (for widgets, apps packages and other)
170 170
         if ($source !== null) {
171
-            $tmpPath = Normalize::diskPath($source . DIRECTORY_SEPARATOR . $path . '.php');
171
+            $tmpPath = Normalize::diskPath($source.DIRECTORY_SEPARATOR.$path.'.php');
172 172
             if (File::exist($tmpPath)) {
173 173
                 // add notify for native views
174 174
                 if (App::$Debug) {
175
-                    App::$Debug->addMessage('Render native viewer: ' . Str::replace(root, null, $tmpPath), 'info');
175
+                    App::$Debug->addMessage('Render native viewer: '.Str::replace(root, null, $tmpPath), 'info');
176 176
                 }
177 177
 
178 178
                 return $tmpPath;
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
         }
181 181
 
182 182
         if (App::$Debug) {
183
-            App::$Debug->addMessage('Viewer not founded on rendering: ' . $path, 'warning');
183
+            App::$Debug->addMessage('Viewer not founded on rendering: '.$path, 'warning');
184 184
         }
185 185
 
186 186
         return null;
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
         foreach ($items as $item) {
277 277
             $item = trim($item, '/');
278 278
             if (!Str::startsWith(App::$Alias->scriptUrl, $item) && !Str::startsWith('http', $item)) { // is local without proto and domain
279
-                $item = App::$Alias->scriptUrl . '/' . $item;
279
+                $item = App::$Alias->scriptUrl.'/'.$item;
280 280
             }
281 281
             $output[] = $item;
282 282
         }
@@ -285,9 +285,9 @@  discard block
 block discarded – undo
285 285
         $output = null;
286 286
         foreach ($clear as $row) {
287 287
             if ($type === 'css') {
288
-                $output .= '<link rel="stylesheet" type="text/css" href="' . $row . '">' . "\n";
288
+                $output .= '<link rel="stylesheet" type="text/css" href="'.$row.'">'."\n";
289 289
             } elseif ($type === 'js') {
290
-                $output .= '<script src="' . $row . '"></script>' . "\n";
290
+                $output .= '<script src="'.$row.'"></script>'."\n";
291 291
             }
292 292
         }
293 293
 
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 
311 311
         $code = null;
312 312
         foreach (App::$Alias->getPlainCode($type) as $row) {
313
-            $code .= $row . "\n";
313
+            $code .= $row."\n";
314 314
         }
315 315
 
316 316
         return $code;
Please login to merge, or discard this patch.
src/Traits/ModelValidator.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
                     } elseif (method_exists($class, $obj)) { // maybe its a function?
140 140
                         $class = $class::$obj; // call function
141 141
                     } else {
142
-                        throw new SyntaxException('Filter callback execution failed: ' . $filterName);
142
+                        throw new SyntaxException('Filter callback execution failed: '.$filterName);
143 143
                     }
144 144
                 }
145 145
             }
@@ -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,14 +157,14 @@  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
 
163 163
         // if one from all validation tests is fail - mark as incorrect attribute
164 164
         if ($check !== true) {
165 165
             $this->_badAttr[] = $propertyName;
166 166
             if (App::$Debug) {
167
-                App::$Debug->addMessage('Validation failed. Property: ' . $propertyName . ', filter: ' . $filterName, 'warning');
167
+                App::$Debug->addMessage('Validation failed. Property: '.$propertyName.', filter: '.$filterName, 'warning');
168 168
             }
169 169
         } else {
170 170
             $field_set_name = $propertyName;
Please login to merge, or discard this patch.
src/Properties.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
         }
43 43
 
44 44
         // try to load from file
45
-        $configFile = ucfirst(Str::lowerCase($configName)) . '.php';
46
-        if (File::exist('/Private/Config/' . $configFile)) {
47
-            $this->data[$configName] = File::inc('/Private/Config/' . $configFile, true);
45
+        $configFile = ucfirst(Str::lowerCase($configName)).'.php';
46
+        if (File::exist('/Private/Config/'.$configFile)) {
47
+            $this->data[$configName] = File::inc('/Private/Config/'.$configFile, true);
48 48
             return true;
49 49
         }
50 50
 
@@ -137,12 +137,12 @@  discard block
 block discarded – undo
137 137
      */
138 138
     public function writeConfig(string $configFile, array $data): bool
139 139
     {
140
-        $path = '/Private/Config/' . ucfirst(Str::lowerCase($configFile)) . '.php';
140
+        $path = '/Private/Config/'.ucfirst(Str::lowerCase($configFile)).'.php';
141 141
         if (!File::exist($path) || !File::writable($path)) {
142 142
             return false;
143 143
         }
144 144
 
145
-        $saveData = '<?php return ' . Arr::exportVar($data) . ';';
145
+        $saveData = '<?php return '.Arr::exportVar($data).';';
146 146
         File::write($path, $saveData);
147 147
         // overload config values if changed
148 148
         $this->load($configFile, true);
Please login to merge, or discard this patch.
src/I18n/Translate.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
         if (Any::isArray($params) && count($params) > 0) {
57 57
             foreach ($params as $var => $value) {
58
-                $text = Str::replace('%' . $var . '%', $value, $text);
58
+                $text = Str::replace('%'.$var.'%', $value, $text);
59 59
             }
60 60
         }
61 61
         return $text;
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     public function translate(string $text, array $params = null)
71 71
     {
72 72
         $index = null;
73
-        $namespace = 'Apps\Controller\\' . env_name . '\\';
73
+        $namespace = 'Apps\Controller\\'.env_name.'\\';
74 74
         foreach (@debug_backtrace() as $caller) {
75 75
             if (isset($caller['class']) && Str::startsWith($namespace, $caller['class'])) {
76 76
                 $index = Str::sub((string)$caller['class'], Str::length($namespace));
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      */
87 87
     protected function load(string $index): ?array
88 88
     {
89
-        $file = root . '/I18n/' . env_name . '/' . App::$Request->getLanguage() . '/' . $index . '.php';
89
+        $file = root.'/I18n/'.env_name.'/'.App::$Request->getLanguage().'/'.$index.'.php';
90 90
         if (!File::exist($file)) {
91 91
             return [];
92 92
         }
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     public function getAvailableLangs(): array
126 126
     {
127 127
         $langs = ['en'];
128
-        $scan = Directory::scan(root . '/I18n/' . env_name . '/', GLOB_ONLYDIR, true);
128
+        $scan = Directory::scan(root.'/I18n/'.env_name.'/', GLOB_ONLYDIR, true);
129 129
         foreach ($scan as $row) {
130 130
             $langs[] = trim($row, '/');
131 131
         }
Please login to merge, or discard this patch.
src/App.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -187,24 +187,24 @@  discard block
 block discarded – undo
187 187
         $html = null;
188 188
         // lets try to get html full content to page render
189 189
         try {
190
-            $this->startMeasure(__METHOD__ . '::callback');
190
+            $this->startMeasure(__METHOD__.'::callback');
191 191
             /** @var \Ffcms\Core\Arch\Controller $callClass */
192 192
             $callClass = null;
193
-            $callMethod = 'action' . self::$Request->getAction();
193
+            $callMethod = 'action'.self::$Request->getAction();
194 194
 
195 195
             // define callback class namespace/name full path
196
-            $cName = (self::$Request->getCallbackAlias() ?? '\Apps\Controller\\' . env_name . '\\' . self::$Request->getController());
196
+            $cName = (self::$Request->getCallbackAlias() ?? '\Apps\Controller\\'.env_name.'\\'.self::$Request->getController());
197 197
             if (!class_exists($cName)) {
198
-                throw new NotFoundException('Callback class not found: ' . App::$Security->strip_tags($cName));
198
+                throw new NotFoundException('Callback class not found: '.App::$Security->strip_tags($cName));
199 199
             }
200 200
 
201 201
             $callClass = new $cName;
202 202
             // check if callback method (action) is exist in class object
203 203
             if (!method_exists($callClass, $callMethod)) {
204
-                throw new NotFoundException('Method "' . App::$Security->strip_tags($callMethod) . '()" not founded in "' . get_class($callClass) . '"');
204
+                throw new NotFoundException('Method "'.App::$Security->strip_tags($callMethod).'()" not founded in "'.get_class($callClass).'"');
205 205
             }
206 206
 
207
-            $this->stopMeasure(__METHOD__ . '::callback');
207
+            $this->stopMeasure(__METHOD__.'::callback');
208 208
             $params = [];
209 209
             if (!Str::likeEmpty(self::$Request->getID())) {
210 210
                 $params[] = self::$Request->getID();
@@ -231,10 +231,10 @@  discard block
 block discarded – undo
231 231
                 ]));
232 232
             }
233 233
 
234
-            $this->startMeasure($cName . '::' . $callMethod);
234
+            $this->startMeasure($cName.'::'.$callMethod);
235 235
             // make callback call to action in controller and get response
236 236
             $actionResponse = call_user_func_array([$callClass, $callMethod], $params);
237
-            $this->stopMeasure($cName . '::' . $callMethod);
237
+            $this->stopMeasure($cName.'::'.$callMethod);
238 238
 
239 239
             // set response to controller attribute
240 240
             if (!Str::likeEmpty($actionResponse)) {
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
                 $html = $e->display();
250 250
             } else { // or hook exception to system based :)))
251 251
                 if (App::$Debug) {
252
-                    $msg = $e->getMessage() . $e->getTraceAsString();
252
+                    $msg = $e->getMessage().$e->getTraceAsString();
253 253
                     $html = (new NativeException($msg))->display();
254 254
                 } else {
255 255
                     $html = (new NativeException($e->getMessage()))->display();
Please login to merge, or discard this patch.
src/Network/Response.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,10 +22,10 @@
 block discarded – undo
22 22
     {
23 23
         $to = trim($to, '/');
24 24
         if (false === $full && !Str::startsWith(App::$Alias->baseUrl, $to)) {
25
-            $to = App::$Alias->baseUrl . '/' . $to;
25
+            $to = App::$Alias->baseUrl.'/'.$to;
26 26
         }
27 27
         $redirect = new FoundationRedirect($to);
28 28
         $redirect->send();
29
-        exit('Redirecting to ' . $to . ' ...');
29
+        exit('Redirecting to '.$to.' ...');
30 30
     }
31 31
 }
Please login to merge, or discard this patch.
src/Network/Request.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
 
62 62
         $basePath = trim(App::$Properties->get('basePath'), '/');
63 63
         if ($basePath !== null && Str::length($basePath) > 0) {
64
-            $basePath = '/' . $basePath;
64
+            $basePath = '/'.$basePath;
65 65
         }
66 66
 
67 67
         if (!defined('env_no_uri') || env_no_uri === false) {
68
-            $basePath .= '/' . strtolower(env_name);
68
+            $basePath .= '/'.strtolower(env_name);
69 69
         }
70 70
 
71 71
         // we never try to use path's without friendly url's
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
             } else {
92 92
                 // try to find language in pathway
93 93
                 foreach (App::$Properties->get('languages') as $lang) {
94
-                    if (Str::startsWith('/' . $lang, $this->getPathInfo())) {
94
+                    if (Str::startsWith('/'.$lang, $this->getPathInfo())) {
95 95
                         $this->language = $lang;
96 96
                         $this->languageInPath = true;
97 97
                     }
@@ -118,11 +118,11 @@  discard block
 block discarded – undo
118 118
                     // parse query string
119 119
                     $queryString = null;
120 120
                     if (count($this->query->all()) > 0) {
121
-                        $queryString = '?' . http_build_query($this->query->all());
121
+                        $queryString = '?'.http_build_query($this->query->all());
122 122
                     }
123 123
 
124 124
                     // build response with redirect to language-based path
125
-                    $response = new Redirect($this->getSchemeAndHttpHost() . $this->basePath . '/' . $userLang . $this->getPathInfo() . $queryString);
125
+                    $response = new Redirect($this->getSchemeAndHttpHost().$this->basePath.'/'.$userLang.$this->getPathInfo().$queryString);
126 126
                     $response->send();
127 127
                     exit();
128 128
                 }
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
         if (array_key_exists($pathway, $routing['Redirect'])) {
182 182
             $target = $this->getSchemeAndHttpHost(); // . $this->getBasePath() . '/' . rtrim($routing['Redirect'][$pathway], '/');
183 183
             if ($this->getBasePath() !== null && !Str::likeEmpty($this->getBasePath())) {
184
-                $target .= '/' . $this->getBasePath();
184
+                $target .= '/'.$this->getBasePath();
185 185
             }
186 186
             $target .= rtrim($routing['Redirect'][$pathway], '/');
187 187
             $redirect = new Redirect($target);
@@ -207,9 +207,9 @@  discard block
 block discarded – undo
207 207
             // find "new path" as binding uri slug
208 208
             $binding = array_search($pathway, $map, true);
209 209
             // build url to redirection
210
-            $url = $this->getSchemeAndHttpHost() . $this->getBasePath() . '/';
210
+            $url = $this->getSchemeAndHttpHost().$this->getBasePath().'/';
211 211
             if (App::$Properties->get('multiLanguage')) {
212
-                $url .= $this->language . '/';
212
+                $url .= $this->language.'/';
213 213
             }
214 214
             $url .= ltrim($binding, '/');
215 215
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
     {
307 307
         $route = $this->languageInPath ? Str::sub(parent::getPathInfo(), Str::length($this->language) + 1) : parent::getPathInfo();
308 308
         if (!Str::startsWith('/', $route)) {
309
-            $route = '/' . $route;
309
+            $route = '/'.$route;
310 310
         }
311 311
         return $route;
312 312
     }
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
      */
473 473
     public function getFullUrl(): string
474 474
     {
475
-        return $this->getSchemeAndHttpHost() . $this->getRequestUri();
475
+        return $this->getSchemeAndHttpHost().$this->getRequestUri();
476 476
     }
477 477
 
478 478
     /**
Please login to merge, or discard this patch.