@@ -22,10 +22,10 @@ |
||
| 22 | 22 | { |
| 23 | 23 | $to = trim($to, '/'); |
| 24 | 24 | if (!$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 | } |
@@ -58,11 +58,11 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | $basePath = trim(App::$Properties->get('basePath'), '/'); |
| 60 | 60 | if ($basePath !== null && Str::length($basePath) > 0) { |
| 61 | - $basePath = '/' . $basePath; |
|
| 61 | + $basePath = '/'.$basePath; |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | if (!defined('env_no_uri') || env_no_uri === false) { |
| 65 | - $basePath .= '/' . strtolower(env_name); |
|
| 65 | + $basePath .= '/'.strtolower(env_name); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | // we never try to use path's without friendly url's |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | { |
| 96 | 96 | $route = $this->languageInPath ? Str::sub(parent::getPathInfo(), Str::length($this->language) + 1) : parent::getPathInfo(); |
| 97 | 97 | if (!Str::startsWith('/', $route)) { |
| 98 | - $route = '/' . $route; |
|
| 98 | + $route = '/'.$route; |
|
| 99 | 99 | } |
| 100 | 100 | return $route; |
| 101 | 101 | } |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | public function getFullUrl(): string |
| 131 | 131 | { |
| 132 | - return $this->getSchemeAndHttpHost() . $this->getRequestUri(); |
|
| 132 | + return $this->getSchemeAndHttpHost().$this->getRequestUri(); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | $url = $this->getSchemeAndHttpHost(); |
| 157 | 157 | $sub = null; |
| 158 | 158 | if ($this->getInterfaceSlug() && Str::length($this->getInterfaceSlug()) > 0) { |
| 159 | - $sub = $this->getInterfaceSlug() . '/'; |
|
| 159 | + $sub = $this->getInterfaceSlug().'/'; |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | if ($this->languageInPath()) { |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | |
| 36 | 36 | // check if class exist |
| 37 | 37 | if (!class_exists(self::$class)) { |
| 38 | - return 'Error: Widget is not founded: ' . self::$class; |
|
| 38 | + return 'Error: Widget is not founded: '.self::$class; |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** @var iWidget $object */ |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | if (array_key_exists($pathway, $routing['Redirect'])) { |
| 37 | 37 | $target = $this->getSchemeAndHttpHost(); // . $this->getBasePath() . '/' . rtrim($routing['Redirect'][$pathway], '/'); |
| 38 | 38 | if ($this->getBasePath() !== null && !Str::likeEmpty($this->getBasePath())) { |
| 39 | - $target .= '/' . $this->getBasePath(); |
|
| 39 | + $target .= '/'.$this->getBasePath(); |
|
| 40 | 40 | } |
| 41 | 41 | $target .= rtrim($routing['Redirect'][$pathway], '/'); |
| 42 | 42 | $redirect = new RedirectResponse($target); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | // safe other parts to arguments if exist |
| 66 | 66 | if (count($pathArray) > 0) { |
| 67 | - $this->args = array_map(function ($in) { |
|
| 67 | + $this->args = array_map(function($in) { |
|
| 68 | 68 | return Any::isStr($in) ? urldecode($in) : $in; |
| 69 | 69 | }, $pathArray); |
| 70 | 70 | } |
@@ -184,12 +184,12 @@ discard block |
||
| 184 | 184 | try { |
| 185 | 185 | /** @var \Ffcms\Core\Arch\Controller $callClass */ |
| 186 | 186 | $callClass = $this->getCallbackClass(); |
| 187 | - $callMethod = 'action' . self::$Request->getAction(); |
|
| 187 | + $callMethod = 'action'.self::$Request->getAction(); |
|
| 188 | 188 | $arguments = self::$Request->getArguments(); |
| 189 | 189 | |
| 190 | 190 | // check if callback method (action) is exist in class object |
| 191 | 191 | if (!method_exists($callClass, $callMethod)) { |
| 192 | - throw new NotFoundException('Method "' . App::$Security->strip_tags($callMethod) . '()" not founded in "' . get_class($callClass) . '"'); |
|
| 192 | + throw new NotFoundException('Method "'.App::$Security->strip_tags($callMethod).'()" not founded in "'.get_class($callClass).'"'); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | // check if method arguments counts equals passed count |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | $response = $e->display(); |
| 221 | 221 | } else { // or hook exception to system based :))) |
| 222 | 222 | if (App::$Debug) { |
| 223 | - $msg = $e->getMessage() . $e->getTraceAsString(); |
|
| 223 | + $msg = $e->getMessage().$e->getTraceAsString(); |
|
| 224 | 224 | $response = (new NativeException($msg))->display(); |
| 225 | 225 | } else { |
| 226 | 226 | $response = (new NativeException($e->getMessage()))->display(); |
@@ -242,9 +242,9 @@ discard block |
||
| 242 | 242 | private function getCallbackClass() |
| 243 | 243 | { |
| 244 | 244 | // define callback class namespace/name full path |
| 245 | - $cName = (self::$Request->getCallbackAlias() ?? '\Apps\Controller\\' . env_name . '\\' . self::$Request->getController()); |
|
| 245 | + $cName = (self::$Request->getCallbackAlias() ?? '\Apps\Controller\\'.env_name.'\\'.self::$Request->getController()); |
|
| 246 | 246 | if (!class_exists($cName)) { |
| 247 | - throw new NotFoundException('Callback class not found: ' . App::$Security->strip_tags($cName)); |
|
| 247 | + throw new NotFoundException('Callback class not found: '.App::$Security->strip_tags($cName)); |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | return new $cName; |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public function setFindSource($value, array $middleware) |
| 57 | 57 | { |
| 58 | - $this->findSource = (bool) $value; |
|
| 58 | + $this->findSource = (bool)$value; |
|
| 59 | 59 | $this->middleware = $middleware; |
| 60 | 60 | } |
| 61 | 61 | /** |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | public function setExplainSource($enabled, $types) |
| 68 | 68 | { |
| 69 | 69 | $this->explainQuery = $enabled; |
| 70 | - if($types){ |
|
| 70 | + if ($types) { |
|
| 71 | 71 | $this->explainTypes = $types; |
| 72 | 72 | } |
| 73 | 73 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $bindings = $connection->prepareBindings($bindings); |
| 90 | 90 | // Run EXPLAIN on this query (if needed) |
| 91 | 91 | if ($this->explainQuery && preg_match('/^('.implode($this->explainTypes).') /i', $query)) { |
| 92 | - $statement = $pdo->prepare('EXPLAIN ' . $query); |
|
| 92 | + $statement = $pdo->prepare('EXPLAIN '.$query); |
|
| 93 | 93 | $statement->execute($bindings); |
| 94 | 94 | $explainResults = $statement->fetchAll(\PDO::FETCH_CLASS); |
| 95 | 95 | } |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | $hints[] = '<code>LIMIT</code> without <code>ORDER BY</code> causes non-deterministic results, depending on the query execution plan'; |
| 161 | 161 | } |
| 162 | 162 | if (preg_match('/LIKE\\s[\'"](%.*?)[\'"]/i', $query, $matches)) { |
| 163 | - $hints[] = 'An argument has a leading wildcard character: <code>' . $matches[1]. '</code>. |
|
| 163 | + $hints[] = 'An argument has a leading wildcard character: <code>'.$matches[1].'</code>. |
|
| 164 | 164 | The predicate with this argument is not sargable and cannot use an index if one exists.'; |
| 165 | 165 | } |
| 166 | 166 | return $hints; |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | protected function parseTrace($index, array $trace) |
| 190 | 190 | { |
| 191 | - $frame = (object) [ |
|
| 191 | + $frame = (object)[ |
|
| 192 | 192 | 'index' => $index, |
| 193 | 193 | 'namespace' => null, |
| 194 | 194 | 'name' => null, |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | list($file, $frame->line) = $this->getTwigInfo($trace); |
| 208 | 208 | } elseif (strpos($file, storage_path()) !== false) { |
| 209 | 209 | $hash = pathinfo($file, PATHINFO_FILENAME); |
| 210 | - if (! $frame->name = $this->findViewFromHash($hash)) { |
|
| 210 | + if (!$frame->name = $this->findViewFromHash($hash)) { |
|
| 211 | 211 | $frame->name = $hash; |
| 212 | 212 | } |
| 213 | 213 | $frame->namespace = 'view'; |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | $property->setAccessible(true); |
| 280 | 280 | $this->reflection['viewfinderViews'] = $property; |
| 281 | 281 | } |
| 282 | - foreach ($property->getValue($finder) as $name => $path){ |
|
| 282 | + foreach ($property->getValue($finder) as $name => $path) { |
|
| 283 | 283 | if (sha1($path) == $hash || md5($path) == $hash) { |
| 284 | 284 | return $name; |
| 285 | 285 | } |
@@ -372,9 +372,9 @@ discard block |
||
| 372 | 372 | 'connection' => $query['connection'], |
| 373 | 373 | ]; |
| 374 | 374 | //Add the results from the explain as new rows |
| 375 | - foreach($query['explain'] as $explain){ |
|
| 375 | + foreach ($query['explain'] as $explain) { |
|
| 376 | 376 | $statements[] = [ |
| 377 | - 'sql' => ' - EXPLAIN #' . $explain->id . ': `' . $explain->table . '` (' . $explain->select_type . ')', |
|
| 377 | + 'sql' => ' - EXPLAIN #'.$explain->id.': `'.$explain->table.'` ('.$explain->select_type.')', |
|
| 378 | 378 | 'type' => 'explain', |
| 379 | 379 | 'params' => $explain, |
| 380 | 380 | 'row_count' => $explain->rows, |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | ]; |
| 383 | 383 | } |
| 384 | 384 | } |
| 385 | - $nb_statements = array_filter($queries, function ($query) { |
|
| 385 | + $nb_statements = array_filter($queries, function($query) { |
|
| 386 | 386 | return $query['type'] == 'query'; |
| 387 | 387 | }); |
| 388 | 388 | $data = [ |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | protected function buildFakePage() |
| 50 | 50 | { |
| 51 | 51 | try { |
| 52 | - $rawResponse = App::$View->render('_core/exceptions/' . $this->tpl, ['msg' => $this->text]); |
|
| 52 | + $rawResponse = App::$View->render('_core/exceptions/'.$this->tpl, ['msg' => $this->text]); |
|
| 53 | 53 | if (Str::likeEmpty($rawResponse)) { |
| 54 | 54 | $rawResponse = $this->text; |
| 55 | 55 | } |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | protected function sendHTML($message = null) |
| 59 | 59 | { |
| 60 | 60 | //header('HTTP/1.1 404 Not Found'); |
| 61 | - return '<!DOCTYPE html><html><head><title>An error has occurred</title></head><body><div style="width:60%; margin: auto; background-color: #fcc;border: 1px solid #faa; padding: 0.5em 1em;"><h1 style="font-size: 120%">Runtime error</h1><p>' . $message . '</p></div></body></html>'; |
|
| 61 | + return '<!DOCTYPE html><html><head><title>An error has occurred</title></head><body><div style="width:60%; margin: auto; background-color: #fcc;border: 1px solid #faa; padding: 0.5em 1em;"><h1 style="font-size: 120%">Runtime error</h1><p>'.$message.'</p></div></body></html>'; |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |