Passed
Push — master ( 96a485...3c999b )
by Fran
02:49
created
src/base/types/helpers/ResponseHelper.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
             Logger::log('Adding debug headers to render response');
77 77
             $vars["__DEBUG__"]["includes"] = get_included_files();
78 78
             $vars["__DEBUG__"]["trace"] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
79
-            header('X-PSFS-DEBUG-TS: ' . Dispatcher::getInstance()->getTs() . ' s');
80
-            header('X-PSFS-DEBUG-MEM: ' . Dispatcher::getInstance()->getMem('MBytes') . ' MBytes');
81
-            header('X-PSFS-DEBUG-FILES: ' . count(get_included_files()) . ' files opened');
79
+            header('X-PSFS-DEBUG-TS: '.Dispatcher::getInstance()->getTs().' s');
80
+            header('X-PSFS-DEBUG-MEM: '.Dispatcher::getInstance()->getMem('MBytes').' MBytes');
81
+            header('X-PSFS-DEBUG-FILES: '.count(get_included_files()).' files opened');
82 82
         }
83 83
 
84 84
         return $vars;
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
      */
94 94
     public static function httpNotFound(Exception $exception = NULL, $isJson = false)
95 95
     {
96
-        if(self::isTest()) {
96
+        if (self::isTest()) {
97 97
             return 404;
98 98
         }
99 99
         Inspector::stats('[Router] Throw not found exception', Inspector::SCOPE_DEBUG);
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
         }
109 109
 
110 110
         $notFoundRoute = Config::getParam('route.404');
111
-        if(null !== $notFoundRoute) {
111
+        if (null !== $notFoundRoute) {
112 112
             Request::getInstance()->redirect(Router::getInstance()->getRoute($notFoundRoute, true));
113
-        } else {
113
+        }else {
114 114
             return $template->render('error.html.twig', array(
115 115
                 'exception' => $exception,
116 116
                 'trace' => $exception->getTraceAsString(),
Please login to merge, or discard this patch.
src/base/types/helpers/SecurityHelper.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
             && (preg_match('/^\/(admin|setup\-admin)/i', $route) || Config::getParam('restricted', false))
35 35
         ) {
36 36
             if (!self::isTest() &&
37
-                null === Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json', Cache::JSONGZ, true)) {
37
+                null === Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json', Cache::JSONGZ, true)) {
38 38
                 throw new AdminCredentialsException();
39 39
             }
40 40
             if (!Security::getInstance()->checkAdmin()) {
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
         $token = '';
55 55
         $length = strlen($timestamp);
56 56
         for ($i = 0; $i < $length; $i++) {
57
-            $token = substr($hash, $i, 1) .
58
-                substr($timestamp, $i, 1) .
57
+            $token = substr($hash, $i, 1).
58
+                substr($timestamp, $i, 1).
59 59
                 $token;
60 60
         }
61 61
         return $token;
@@ -74,16 +74,16 @@  discard block
 block discarded – undo
74 74
         $charsLength = strlen(self::RAND_SEP) - 1;
75 75
         $tsLength = strlen($timestamp);
76 76
         $i = 0;
77
-        $partCount = ceil($hashRest / 4);
78
-        $part = substr($hash, $tsLength + $partCount * $i, $partCount);
77
+        $partCount = ceil($hashRest/4);
78
+        $part = substr($hash, $tsLength + $partCount*$i, $partCount);
79 79
         while (false !== $part) {
80
-            $mixedToken .= $part .
81
-                substr(self::RAND_SEP, round(rand(0, $charsLength), 0, PHP_ROUND_HALF_DOWN), 1) .
80
+            $mixedToken .= $part.
81
+                substr(self::RAND_SEP, round(rand(0, $charsLength), 0, PHP_ROUND_HALF_DOWN), 1).
82 82
                 substr(self::RAND_SEP, round(rand(0, $charsLength), 0, PHP_ROUND_HALF_DOWN), 1);
83
-            $part = substr($hash, $tsLength + $partCount * $i, $partCount);
83
+            $part = substr($hash, $tsLength + $partCount*$i, $partCount);
84 84
             $i++;
85 85
         }
86
-        return $mixedToken . $token;
86
+        return $mixedToken.$token;
87 87
     }
88 88
 
89 89
     /**
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     private static function getTs($isOdd = null)
94 94
     {
95 95
         $timestamp = time();
96
-        $tsIsOdd = (bool)((int)substr($timestamp, -1) % 2);
96
+        $tsIsOdd = (bool)((int)substr($timestamp, -1)%2);
97 97
         if (false === $isOdd && !$tsIsOdd) {
98 98
             $timestamp--;
99 99
         } elseif (true === $isOdd && !$tsIsOdd) {
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
         $timestamp = '';
131 131
         $part = strrev($part);
132 132
         for ($i = 0, $ct = strlen($part); $i < $ct; $i++) {
133
-            if ($i % 2 == 0) {
133
+            if ($i%2 == 0) {
134 134
                 $timestamp .= substr($part, $i, 1);
135
-            } else {
135
+            }else {
136 136
                 $partToken .= substr($part, $i, 1);
137 137
             }
138 138
         }
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
             foreach ($parts as $part) {
153 153
                 $token .= $part;
154 154
             }
155
-            $token = $partToken . $token;
155
+            $token = $partToken.$token;
156 156
         }
157 157
         return [$token, $timestamp];
158 158
     }
Please login to merge, or discard this patch.
src/base/types/traits/Router/SluggerTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
     {
51 51
         $this->generateSlugs();
52 52
         GeneratorHelper::createDir(CONFIG_DIR);
53
-        Cache::getInstance()->storeData(CONFIG_DIR . DIRECTORY_SEPARATOR . 'urls.json', [$this->routing, $this->getSlugs()], Cache::JSON, TRUE);
53
+        Cache::getInstance()->storeData(CONFIG_DIR.DIRECTORY_SEPARATOR.'urls.json', [$this->routing, $this->getSlugs()], Cache::JSON, TRUE);
54 54
 
55 55
         return $this;
56 56
     }
Please login to merge, or discard this patch.
src/base/types/traits/Router/ModulesTrait.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
         if ($files->hasResults()) {
55 55
             foreach ($files->getIterator() as $file) {
56 56
                 if ($namespace !== Router::PSFS_BASE_NAMESPACE && method_exists($file, 'getRelativePathname')) {
57
-                    $filename = '\\' . str_replace('/', '\\', str_replace($origen, '', $file->getRelativePathname()));
58
-                } else {
57
+                    $filename = '\\'.str_replace('/', '\\', str_replace($origen, '', $file->getRelativePathname()));
58
+                }else {
59 59
                     $filename = str_replace('/', '\\', str_replace($origen, '', $file->getPathname()));
60 60
                 }
61
-                $routing = $this->addRouting($namespace . str_replace('.php', '', $filename), $routing, $namespace);
61
+                $routing = $this->addRouting($namespace.str_replace('.php', '', $filename), $routing, $namespace);
62 62
             }
63 63
         }
64 64
         $this->initializeFinder();
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
             if (!is_array($this->domains)) {
112 112
                 $this->domains = [];
113 113
             }
114
-            $domain = '@' . $class->getConstant('DOMAIN') . '/';
114
+            $domain = '@'.$class->getConstant('DOMAIN').'/';
115 115
             if (!array_key_exists($domain, $this->domains)) {
116 116
                 $this->domains[$domain] = RouterHelper::extractDomainInfo($class, $domain);
117 117
             }
@@ -138,11 +138,11 @@  discard block
 block discarded – undo
138 138
     private function loadExternalAutoloader($hydrateRoute, SplFileInfo $modulePath, $externalModulePath, &$routing = [])
139 139
     {
140 140
         $extModule = $modulePath->getBasename();
141
-        $moduleAutoloader = realpath($externalModulePath . DIRECTORY_SEPARATOR . $extModule . DIRECTORY_SEPARATOR . 'autoload.php');
141
+        $moduleAutoloader = realpath($externalModulePath.DIRECTORY_SEPARATOR.$extModule.DIRECTORY_SEPARATOR.'autoload.php');
142 142
         if (file_exists($moduleAutoloader)) {
143 143
             include_once $moduleAutoloader;
144 144
             if ($hydrateRoute) {
145
-                $routing = $this->inspectDir($externalModulePath . DIRECTORY_SEPARATOR . $extModule, '\\' . $extModule, $routing);
145
+                $routing = $this->inspectDir($externalModulePath.DIRECTORY_SEPARATOR.$extModule, '\\'.$extModule, $routing);
146 146
             }
147 147
         }
148 148
     }
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
     {
158 158
         try {
159 159
             $module = preg_replace('/(\\\|\/)/', DIRECTORY_SEPARATOR, $module);
160
-            $externalModulePath = VENDOR_DIR . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . 'src';
160
+            $externalModulePath = VENDOR_DIR.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR.'src';
161 161
             if (file_exists($externalModulePath)) {
162 162
                 $externalModule = $this->finder->directories()->in($externalModulePath)->depth(0);
163 163
                 if ($externalModule->hasResults()) {
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
                     }
167 167
                 }
168 168
             }
169
-        } catch (Exception $e) {
169
+        }catch (Exception $e) {
170 170
             Logger::log($e->getMessage(), LOG_WARNING);
171 171
         }
172 172
     }
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
     public function domainExists($domainToCheck) {
179 179
         $exists = false;
180 180
         $domains = array_keys($this->getDomains());
181
-        foreach($domains as $domain) {
181
+        foreach ($domains as $domain) {
182 182
             $cleanDomain = strtolower(str_replace(['@', '/', '\\'], '', $domain));
183
-            if($cleanDomain === strtolower($domainToCheck)) {
183
+            if ($cleanDomain === strtolower($domainToCheck)) {
184 184
                 $exists = true;
185 185
                 break;
186 186
             }
Please login to merge, or discard this patch.
src/base/extension/AssetsParser.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     public function __construct($type = 'js')
54 54
     {
55 55
         $this->type = $type;
56
-        $this->path = WEB_DIR . DIRECTORY_SEPARATOR;
56
+        $this->path = WEB_DIR.DIRECTORY_SEPARATOR;
57 57
         $this->domains = Template::getDomains(true);
58 58
         $this->cdnPath = Config::getParam('resources.cdn.url', Request::getInstance()->getRootUrl());
59 59
     }
@@ -66,12 +66,12 @@  discard block
 block discarded – undo
66 66
      */
67 67
     public function addFile($filename)
68 68
     {
69
-        if (file_exists($this->path . $filename) && preg_match('/\.' . $this->type . '$/i', $filename)) {
69
+        if (file_exists($this->path.$filename) && preg_match('/\.'.$this->type.'$/i', $filename)) {
70 70
             $this->files[] = $filename;
71 71
         } elseif (!empty($this->domains)) {
72 72
             foreach ($this->domains as $domain => $paths) {
73 73
                 $domainFilename = str_replace($domain, $paths["public"], $filename);
74
-                if (file_exists($domainFilename) && preg_match('/\.' . $this->type . '$/i', $domainFilename)) {
74
+                if (file_exists($domainFilename) && preg_match('/\.'.$this->type.'$/i', $domainFilename)) {
75 75
                     $this->files[] = $domainFilename;
76 76
                 }
77 77
             }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     public function setHash($hash)
89 89
     {
90 90
         $cache = Config::getParam('cache.var', '');
91
-        $this->hash = $hash . (strlen($cache) ? '.' : '') . $cache;
91
+        $this->hash = $hash.(strlen($cache) ? '.' : '').$cache;
92 92
         return $this;
93 93
     }
94 94
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
             $sourceFile = explode("?", $sourceFile);
151 151
             $sourceFile = $sourceFile[0];
152 152
         }
153
-        $orig = realpath(dirname($filenamePath) . DIRECTORY_SEPARATOR . $sourceFile);
153
+        $orig = realpath(dirname($filenamePath).DIRECTORY_SEPARATOR.$sourceFile);
154 154
         return $orig;
155 155
     }
156 156
 
@@ -167,15 +167,15 @@  discard block
 block discarded – undo
167 167
         if (preg_match_all('#url\((.*?)\)#', $line, $urls, PREG_SET_ORDER)) {
168 168
             foreach ($urls as $source) {
169 169
                 $orig = self::calculateResourcePathname($filenamePath, $source);
170
-                if(!empty($orig)) {
170
+                if (!empty($orig)) {
171 171
                     $orig_part = preg_split("/Public/i", $orig);
172
-                    $dest = WEB_DIR . $orig_part[1];
172
+                    $dest = WEB_DIR.$orig_part[1];
173 173
                     GeneratorHelper::createDir(dirname($dest));
174 174
                     if (@copy($orig, $dest) === false) {
175
-                        throw new ConfigException("Can't copy " . $orig . " to " . $dest);
175
+                        throw new ConfigException("Can't copy ".$orig." to ".$dest);
176 176
                     }
177
-                } else {
178
-                    Logger::log($filenamePath . ' has an empty origin with the url ' . $source, LOG_WARNING);
177
+                }else {
178
+                    Logger::log($filenamePath.' has an empty origin with the url '.$source, LOG_WARNING);
179 179
                 }
180 180
             }
181 181
         }
Please login to merge, or discard this patch.
src/base/extension/TemplateFunctions.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -43,13 +43,13 @@  discard block
 block discarded – undo
43 43
 
44 44
         $filePath = '';
45 45
         if (!file_exists($filePath)) {
46
-            $filePath = BASE_DIR . $string;
46
+            $filePath = BASE_DIR.$string;
47 47
         }
48 48
         $filenamePath = AssetsHelper::findDomainPath($string, $filePath);
49 49
 
50 50
         $filePath = self::processAsset($string, $name, $return, $filenamePath);
51 51
         $basePath = Config::getParam('resources.cdn.url', Request::getInstance()->getRootUrl());
52
-        $returnPath = empty($name) ? $basePath . '/' . $filePath : $name;
52
+        $returnPath = empty($name) ? $basePath.'/'.$filePath : $name;
53 53
         return $return ? $returnPath : '';
54 54
     }
55 55
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         $router = Router::getInstance();
67 67
         try {
68 68
             return $router->getRoute($path, $absolute, $params);
69
-        } catch (\Exception $e) {
69
+        }catch (\Exception $e) {
70 70
             return $router->getRoute('', $absolute, $params);
71 71
         }
72 72
     }
@@ -213,9 +213,9 @@  discard block
 block discarded – undo
213 213
     {
214 214
         $data = file_get_contents($filenamePath);
215 215
         if (!empty($name)) {
216
-            file_put_contents(WEB_DIR . DIRECTORY_SEPARATOR . $name, $data);
217
-        } else {
218
-            file_put_contents($base . $filePath, $data);
216
+            file_put_contents(WEB_DIR.DIRECTORY_SEPARATOR.$name, $data);
217
+        }else {
218
+            file_put_contents($base.$filePath, $data);
219 219
         }
220 220
     }
221 221
 
@@ -234,9 +234,9 @@  discard block
 block discarded – undo
234 234
         if (file_exists($filenamePath)) {
235 235
             list($base, $htmlBase, $filePath) = AssetsHelper::calculateAssetPath($string, $name, $return, $filenamePath);
236 236
             //Creamos el directorio si no existe
237
-            GeneratorHelper::createDir($base . $htmlBase);
237
+            GeneratorHelper::createDir($base.$htmlBase);
238 238
             //Si se ha modificado
239
-            if (!file_exists($base . $filePath) || filemtime($base . $filePath) < filemtime($filenamePath)) {
239
+            if (!file_exists($base.$filePath) || filemtime($base.$filePath) < filemtime($filenamePath)) {
240 240
                 if ($htmlBase === 'css') {
241 241
                     self::processCssLines($filenamePath);
242 242
                 }
Please login to merge, or discard this patch.
src/base/types/helpers/SlackHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
             'attachments' => [
31 31
                 [
32 32
                     "author_name" => $request->getRootUrl(true),
33
-                    "text" => $file . ($line !== '' ? ' [' . $line . ']' : ''),
33
+                    "text" => $file.($line !== '' ? ' ['.$line.']' : ''),
34 34
                     "color" => Config::getParam('debug', true) ? 'warning' : "danger",
35 35
                     "title" => $message,
36 36
                     'fallback' => 'PSFS Error notifier',
Please login to merge, or discard this patch.
src/base/types/helpers/RouterHelper.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -24,11 +24,11 @@  discard block
 block discarded – undo
24 24
     {
25 25
         Inspector::stats('[RouterHelper] Getting class to call for executing the request action', Inspector::SCOPE_DEBUG);
26 26
         Logger::log('Getting class to call for executing the request action', LOG_DEBUG, $action);
27
-        $actionClass = class_exists($action['class']) ? $action['class'] : "\\" . $action['class'];
27
+        $actionClass = class_exists($action['class']) ? $action['class'] : "\\".$action['class'];
28 28
         $reflectionClass = new ReflectionClass($actionClass);
29 29
         if ($reflectionClass->hasMethod('getInstance')) {
30 30
             $class = $reflectionClass->getMethod('getInstance')->invoke(null, $action['method']);
31
-        } else {
31
+        }else {
32 32
             $class = new $actionClass;
33 33
         }
34 34
         return $class;
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     public static function extractComponents($route, $pattern)
63 63
     {
64 64
         Inspector::stats('[RouterHelper] Extracting parts for the request to execute', Inspector::SCOPE_DEBUG);
65
-        if(Config::getParam('allow.double.slashes', true)) {
65
+        if (Config::getParam('allow.double.slashes', true)) {
66 66
             $route = preg_replace("/\/\//", '/', $route);
67 67
         }
68 68
         $url = parse_url($route);
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
             $cleanPatternSep--;
101 101
         }
102 102
 
103
-        if(Config::getParam('allow.double.slashes', true)) {
103
+        if (Config::getParam('allow.double.slashes', true)) {
104 104
             $path = preg_replace("/\/\//", '/', $path);
105 105
         }
106 106
         $pathSep = count(explode('/', $path));
@@ -120,14 +120,14 @@  discard block
 block discarded – undo
120 120
      */
121 121
     public static function matchRoutePattern($routePattern, $path)
122 122
     {
123
-        if(Config::getParam('allow.double.slashes', true)) {
123
+        if (Config::getParam('allow.double.slashes', true)) {
124 124
             $path = preg_replace("/\/\//", '/', $path);
125 125
         }
126 126
         $expr = preg_replace('/\{([^}]+)\}/', '%%%', $routePattern);
127 127
         $expr = preg_quote($expr, '/');
128 128
         $expr = str_replace('%%%', '(.*)', $expr);
129 129
         $expr2 = preg_replace('/\(\.\*\)$/', '', $expr);
130
-        $matched = preg_match('/^' . $expr . '\/?$/i', $path) || preg_match('/^' . $expr2 . '?$/i', $path);
130
+        $matched = preg_match('/^'.$expr.'\/?$/i', $path) || preg_match('/^'.$expr2.'?$/i', $path);
131 131
         return $matched;
132 132
     }
133 133
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
      */
139 139
     public static function extractDomainInfo(ReflectionClass $class, $domain)
140 140
     {
141
-        $path = dirname($class->getFileName()) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR;
141
+        $path = dirname($class->getFileName()).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR;
142 142
         $templatesPath = 'templates';
143 143
         $publicPath = 'public';
144 144
         $modelsPath = 'models';
@@ -148,13 +148,13 @@  discard block
 block discarded – undo
148 148
             $modelsPath = ucfirst($modelsPath);
149 149
         }
150 150
         if ($class->hasConstant('TPL')) {
151
-            $templatesPath .= DIRECTORY_SEPARATOR . $class->getConstant('TPL');
151
+            $templatesPath .= DIRECTORY_SEPARATOR.$class->getConstant('TPL');
152 152
         }
153 153
         return [
154 154
             'base' => $path,
155
-            'template' => $path . $templatesPath,
156
-            'model' => $path . $modelsPath,
157
-            'public' => $path . $publicPath,
155
+            'template' => $path.$templatesPath,
156
+            'model' => $path.$modelsPath,
157
+            'public' => $path.$publicPath,
158 158
         ];
159 159
     }
160 160
 
@@ -175,12 +175,12 @@  discard block
 block discarded – undo
175 175
             foreach ($parameters as $param) {
176 176
                 if ($param->isOptional() && !is_array($param->getDefaultValue())) {
177 177
                     $params[$param->getName()] = $param->getDefaultValue();
178
-                    $default = str_replace('{' . $param->getName() . '}', $param->getDefaultValue(), $regex);
178
+                    $default = str_replace('{'.$param->getName().'}', $param->getDefaultValue(), $regex);
179 179
                 } elseif (!$param->isOptional()) {
180 180
                     $requirements[] = $param->getName();
181 181
                 }
182 182
             }
183
-        } else {
183
+        }else {
184 184
             $default = $regex;
185 185
         }
186 186
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
             $httpMethod = AnnotationHelper::extractReflectionHttpMethod($docComments);
211 211
             $icon = AnnotationHelper::extractDocIcon($docComments);
212 212
             $label = AnnotationHelper::extractReflectionLabel(str_replace('{__API__}', $api, $docComments));
213
-            $route = $httpMethod . "#|#" . $regex;
213
+            $route = $httpMethod."#|#".$regex;
214 214
             $route = preg_replace('/(\\r|\\f|\\t|\\n)/', '', $route);
215 215
             $info = [
216 216
                 'method' => $method->getName(),
Please login to merge, or discard this patch.
src/base/Request.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
      */
123 123
     public static function header($name, $default = null)
124 124
     {
125
-        return self::getInstance()->getHeader($name,  $default);
125
+        return self::getInstance()->getHeader($name, $default);
126 126
     }
127 127
 
128 128
     /**
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
         $header = null;
136 136
         if ($this->hasHeader($name)) {
137 137
             $header = $this->header[$name];
138
-        } else if(array_key_exists('h_' . strtolower($name), $this->query)) {
139
-            $header = $this->query['h_' . strtolower($name)];
140
-        } else if(array_key_exists('HTTP_' . strtoupper(str_replace('-', '_', $name)), $this->server)) {
141
-            $header = $this->getServer('HTTP_' . strtoupper(str_replace('-', '_', $name)));
138
+        }else if (array_key_exists('h_'.strtolower($name), $this->query)) {
139
+            $header = $this->query['h_'.strtolower($name)];
140
+        }else if (array_key_exists('HTTP_'.strtoupper(str_replace('-', '_', $name)), $this->server)) {
141
+            $header = $this->getServer('HTTP_'.strtoupper(str_replace('-', '_', $name)));
142 142
         }
143 143
         return $header ?: $default;
144 144
     }
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
             $url = $this->getServer('HTTP_ORIGIN');
243 243
         }
244 244
         ob_start();
245
-        header('Location: ' . $url);
245
+        header('Location: '.$url);
246 246
         ob_end_clean();
247 247
         Security::getInstance()->updateSession();
248 248
         exit(t('Redirect...'));
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
         $url = $this->getServerName();
259 259
         $protocol = $hasProtocol ? $this->getProtocol() : '';
260 260
         if (!empty($protocol)) {
261
-            $url = $protocol . $url;
261
+            $url = $protocol.$url;
262 262
         }
263 263
         $url = $this->checkServerPort($url);
264 264
         return $url;
@@ -272,15 +272,15 @@  discard block
 block discarded – undo
272 272
     {
273 273
         $port = (integer)$this->getServer('SERVER_PORT');
274 274
         $host = $this->getServer('HTTP_HOST');
275
-        if(!empty($host)) {
275
+        if (!empty($host)) {
276 276
             $parts = explode(':', $host);
277 277
             $hostPort = (integer)end($parts);
278
-            if($hostPort !== $port && count($parts) > 1) {
278
+            if ($hostPort !== $port && count($parts) > 1) {
279 279
                 $port = $hostPort;
280 280
             }
281 281
         }
282 282
         if (!in_array($port, [80, 443], true)) {
283
-            $url .= ':' . $port;
283
+            $url .= ':'.$port;
284 284
         }
285 285
         return $url;
286 286
     }
Please login to merge, or discard this patch.