Passed
Push — master ( 1f6505...f5f414 )
by Marcio
09:08
created
src/Ballybran/Library/CSSCache.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -54,8 +54,9 @@  discard block
 block discarded – undo
54 54
 
55 55
     private function style_changed() {
56 56
     foreach ($this->filenames as $filename) {
57
-            if (!is_file($this->get_cache_name($filename)))
58
-        return TRUE;
57
+            if (!is_file($this->get_cache_name($filename))) {
58
+                    return TRUE;
59
+            }
59 60
     }
60 61
     return FALSE;
61 62
     }
@@ -86,8 +87,9 @@  discard block
 block discarded – undo
86 87
 
87 88
     // remove any old, lingering caches for this file
88 89
     if ($dead_files = glob($this->get_cache_name($filename, TRUE), GLOB_NOESCAPE)) {
89
-            foreach ($dead_files as $dead_file)
90
-        unlink($dead_file);
90
+            foreach ($dead_files as $dead_file) {
91
+                    unlink($dead_file);
92
+            }
91 93
     }
92 94
 
93 95
     $compressed = $this->compress(file_get_contents($filename));
Please login to merge, or discard this patch.
src/Ballybran/Helpers/Utility/Ucfirst.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@
 block discarded – undo
85 85
                 if ($characterDeficit == 0) {
86 86
                     //If the word is full and we're not short any characters, ignore the character
87 87
                     continue;
88
-                }else 
88
+                } else 
89 89
                     $characterDeficit--; //If we are short some characters, decrement the defecit and carry on with adding the character to the abbreviation
90 90
             }
91 91
             $abbreviation .= $currentChar; //Add the character to the abbreviation
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -85,8 +85,10 @@
 block discarded – undo
85 85
                 if ($characterDeficit == 0) {
86 86
                     //If the word is full and we're not short any characters, ignore the character
87 87
                     continue;
88
-                }else 
89
-                    $characterDeficit--; //If we are short some characters, decrement the defecit and carry on with adding the character to the abbreviation
88
+                } else {
89
+                                    $characterDeficit--;
90
+                }
91
+                //If we are short some characters, decrement the defecit and carry on with adding the character to the abbreviation
90 92
             }
91 93
             $abbreviation .= $currentChar; //Add the character to the abbreviation
92 94
             $abbrevLength++; //Increment abbreviation length
Please login to merge, or discard this patch.
src/Ballybran/Core/Http/Middleware/Exception/InvalidArgumentException.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
      */
13 13
     private $invalidMiddleware;
14 14
 
15
-    public function __construct( $invalidMiddleware = null, $code = 0, Throwable $previous = null )
15
+    public function __construct($invalidMiddleware = null, $code = 0, Throwable $previous = null)
16 16
     {
17 17
         $message = \sprintf(self::ERROR_MESSAGE, MiddlewareInterface::class, $this->castStageToString($invalidMiddleware));
18
-        parent::__construct( $message, $code, $previous);
18
+        parent::__construct($message, $code, $previous);
19 19
         $this->invalidMiddleware = $invalidMiddleware;
20 20
     }
21 21
 
@@ -23,20 +23,20 @@  discard block
 block discarded – undo
23 23
      *  return the invalid middleware
24 24
      * @return mixed|null
25 25
      */
26
-    public function getInvalidMiddleware(){
26
+    public function getInvalidMiddleware() {
27 27
         return $this->invalidMiddleware;
28 28
     }
29 29
     private function castStageToString(string $stage) : string{
30 30
         
31
-        if(\is_scalar($stage)){
32
-            return (string) $stage;
31
+        if (\is_scalar($stage)) {
32
+            return (string)$stage;
33 33
         }
34 34
 
35
-        if(\is_scalar($stage)){
35
+        if (\is_scalar($stage)) {
36 36
             return \json_encode($stage) ?: 'array';
37 37
         }
38 38
         
39
-        if(\is_object($stage)){
39
+        if (\is_object($stage)) {
40 40
             return \get_class($stage) ?: 'array';
41 41
         }
42 42
 
Please login to merge, or discard this patch.
src/Ballybran/Config/Config.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -125,8 +125,8 @@
 block discarded – undo
125 125
  *
126 126
  *  O URL base do sistema
127 127
  */
128
-$root=(isset($_SERVER['HTTPS']) ? "https://" : "http://").$_SERVER['HTTP_HOST'];
129
-$root.= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
128
+$root = (isset($_SERVER['HTTPS']) ? "https://" : "http://") . $_SERVER['HTTP_HOST'];
129
+$root .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
130 130
 
131 131
 define('URL', $root);
132 132
 
Please login to merge, or discard this patch.
src/Ballybran/Routing/Router/RouterRequest.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -146,10 +146,10 @@
 block discarded – undo
146 146
         return $headers;
147 147
     }
148 148
 
149
-      /**
150
-     * This static method will create a new Request object, based on the
151
-     * current PHP request.
152
-     */
149
+        /**
150
+         * This static method will create a new Request object, based on the
151
+         * current PHP request.
152
+         */
153 153
     public static function getRequest(): Request
154 154
     {
155 155
         $serverArr = $_SERVER;
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -175,13 +175,13 @@  discard block
 block discarded – undo
175 175
      */
176 176
     public static function sendResponse(Response $response)
177 177
     {
178
-        header('HTTP/'.$response->getHttpVersion().' '.$response->getStatus().' '.$response->getStatusText());
178
+        header('HTTP/' . $response->getHttpVersion() . ' ' . $response->getStatus() . ' ' . $response->getStatusText());
179 179
         foreach ($response->getHeaders() as $key => $value) {
180 180
             foreach ($value as $k => $v) {
181 181
                 if (0 === $k) {
182
-                    header($key.': '.$v);
182
+                    header($key . ': ' . $v);
183 183
                 } else {
184
-                    header($key.': '.$v, false);
184
+                    header($key . ': ' . $v, false);
185 185
                 }
186 186
             }
187 187
         }
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
                 if (PHP_INT_SIZE > 4) {
205 205
                     // use the dedicated function on 64 Bit systems
206 206
                     // a workaround to make PHP more possible to use mmap based copy, see https://github.com/sabre-io/http/pull/119
207
-                    $left = (int) $contentLength;
207
+                    $left = (int)$contentLength;
208 208
                     // copy with 4MiB chunks
209 209
                     $chunk_size = 4 * 1024 * 1024;
210 210
                     stream_set_chunk_size($output, $chunk_size);
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
                     if (null !== $contentRange && preg_match('/^bytes\s([0-9]+)-([0-9]+)\//i', $contentRange, $matches)) {
215 215
                         // 4kB should be the default page size on most architectures
216 216
                         $pageSize = 4096;
217
-                        $offset = (int) $matches[1];
217
+                        $offset = (int)$matches[1];
218 218
                         $delta = ($offset % $pageSize) > 0 ? ($pageSize - $offset % $pageSize) : 0;
219 219
                         if ($delta > 0) {
220 220
                             $left -= stream_copy_to_stream($body, $output, min($delta, $left));
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
                     }
239 239
                 }
240 240
             } else {
241
-                fwrite($output, $body, (int) $contentLength);
241
+                fwrite($output, $body, (int)$contentLength);
242 242
             }
243 243
         } else {
244 244
             file_put_contents('php://output', $body);
@@ -293,13 +293,13 @@  discard block
 block discarded – undo
293 293
                 // (fast)cgi does not usually do this, however.
294 294
                 case 'PHP_AUTH_USER':
295 295
                     if (isset($serverArray['PHP_AUTH_PW'])) {
296
-                        $headers['Authorization'] = 'Basic '.base64_encode($value.':'.$serverArray['PHP_AUTH_PW']);
296
+                        $headers['Authorization'] = 'Basic ' . base64_encode($value . ':' . $serverArray['PHP_AUTH_PW']);
297 297
                     }
298 298
                     break;
299 299
 
300 300
                 // Similarly, mod_php may also screw around with digest auth.
301 301
                 case 'PHP_AUTH_DIGEST':
302
-                    $headers['Authorization'] = 'Digest '.$value;
302
+                    $headers['Authorization'] = 'Digest ' . $value;
303 303
                     break;
304 304
 
305 305
                 // Apache may prefix the HTTP_AUTHORIZATION header with
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
         $r = new Request($method, $url, $headers);
349 349
         $r->setHttpVersion($httpVersion);
350 350
         $r->setRawServerData($serverArray);
351
-        $r->setAbsoluteUrl($protocol.'://'.$hostName.$url);
351
+        $r->setAbsoluteUrl($protocol . '://' . $hostName . $url);
352 352
 
353 353
         return $r;
354 354
     }
Please login to merge, or discard this patch.
src/Ballybran/Routing/Router.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -345,9 +345,9 @@  discard block
 block discarded – undo
345 345
             if (!empty($currentRoute)) {
346 346
                 $currentRoute = current($currentRoute);
347 347
                 $foundRoute = true;
348
-                $this->runRouteMiddleware($currentRoute, 'before',  $this->request, $this->response);
348
+                $this->runRouteMiddleware($currentRoute, 'before', $this->request, $this->response);
349 349
                 $this->runRouteCommand($currentRoute['callback']);
350
-                $this->runRouteMiddleware($currentRoute, 'after',  $this->request, $this->response);
350
+                $this->runRouteMiddleware($currentRoute, 'after', $this->request, $this->response);
351 351
             }
352 352
         } else {
353 353
             foreach ($this->routes as $data) {
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
                     if ($this->request->validMethod($data['method'], $method)) {
361 361
                         $foundRoute = true;
362 362
 
363
-                        $this->runRouteMiddleware($data, 'before',  $this->reques, $this->response);
363
+                        $this->runRouteMiddleware($data, 'before', $this->reques, $this->response);
364 364
 
365 365
                         array_shift($matched);
366 366
                         $matched = array_map(function($value) {
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
                         }, $matched);
369 369
 
370 370
                         $this->runRouteCommand($data['callback'], $matched, $this->request);
371
-                        $this->runRouteMiddleware($data, 'after',  $this->request, $this->response);
371
+                        $this->runRouteMiddleware($data, 'after', $this->request, $this->response);
372 372
                         break;
373 373
                     }
374 374
                 }
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
      *
401 401
      * @return bool
402 402
      */
403
-    public function group($settings = null, $callback = null, $name =null)
403
+    public function group($settings = null, $callback = null, $name = null)
404 404
     {
405 405
         if ($this->cacheLoaded) {
406 406
             return true;
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
             $this->criateRoute($route, $groupItem, $method, $callback, $settings);
561 561
         }
562 562
 
563
-        private function criateRoute($route, $groupItem, $method, $callback, $settings){
563
+        private function criateRoute($route, $groupItem, $method, $callback, $settings) {
564 564
             $routeName = is_string($callback)
565 565
             ? strtolower(preg_replace(
566 566
                 '/[^\w]/i', '/', str_replace($this->namespaces['controllers'], '', $callback)
Please login to merge, or discard this patch.
src/Ballybran/Core/Http/Message.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         }
61 61
         if (is_string($body) || null === $body) {
62 62
             $stream = fopen('php://temp', 'r+');
63
-            fwrite($stream, (string) $body);
63
+            fwrite($stream, (string)$body);
64 64
             rewind($stream);
65 65
 
66 66
             return $stream;
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
          */
96 96
         $contentLength = $this->getHeader('Content-Length');
97 97
         if (is_int($contentLength) || ctype_digit($contentLength)) {
98
-            return stream_get_contents($body, (int) $contentLength);
98
+            return stream_get_contents($body, (int)$contentLength);
99 99
         }
100 100
 
101 101
         return stream_get_contents($body);
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
      */
205 205
     public function setHeader(string $name, $value)
206 206
     {
207
-        $this->headers[strtolower($name)] = [$name, (array) $value];
207
+        $this->headers[strtolower($name)] = [$name, (array)$value];
208 208
     }
209 209
 
210 210
     /**
@@ -237,12 +237,12 @@  discard block
 block discarded – undo
237 237
         if (isset($this->headers[$lName])) {
238 238
             $this->headers[$lName][1] = array_merge(
239 239
                 $this->headers[$lName][1],
240
-                (array) $value
240
+                (array)$value
241 241
             );
242 242
         } else {
243 243
             $this->headers[$lName] = [
244 244
                 $name,
245
-                (array) $value,
245
+                (array)$value,
246 246
             ];
247 247
         }
248 248
     }
Please login to merge, or discard this patch.
src/Ballybran/Core/Http/Response.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
                 $statusCode,
167 167
                 $statusText
168 168
             ) = explode(' ', $status, 2);
169
-            $statusCode = (int) $statusCode;
169
+            $statusCode = (int)$statusCode;
170 170
         }
171 171
         if ($statusCode < 100 || $statusCode > 999) {
172 172
             throw new \InvalidArgumentException('The HTTP status code must be exactly 3 digits');
@@ -183,10 +183,10 @@  discard block
 block discarded – undo
183 183
      */
184 184
     public function __toString(): string
185 185
     {
186
-        $str = 'HTTP/'.$this->httpVersion.' '.$this->getStatus().' '.$this->getStatusText()."\r\n";
186
+        $str = 'HTTP/' . $this->httpVersion . ' ' . $this->getStatus() . ' ' . $this->getStatusText() . "\r\n";
187 187
         foreach ($this->getHeaders() as $key => $value) {
188 188
             foreach ($value as $v) {
189
-                $str .= $key.': '.$v."\r\n";
189
+                $str .= $key . ': ' . $v . "\r\n";
190 190
             }
191 191
         }
192 192
         $str .= "\r\n";
Please login to merge, or discard this patch.
src/Ballybran/Core/Http/Request.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
     {
115 115
         if (!$this->absoluteUrl) {
116 116
             // Guessing we're a http endpoint.
117
-            $this->absoluteUrl = 'http://'.
118
-                ($this->getHeader('Host') ?? 'localhost').
117
+            $this->absoluteUrl = 'http://' .
118
+                ($this->getHeader('Host') ?? 'localhost') .
119 119
                 $this->getUrl();
120 120
         }
121 121
 
@@ -177,13 +177,13 @@  discard block
 block discarded – undo
177 177
             return trim(substr($uri, strlen($baseUri)), '/');
178 178
         }
179 179
 
180
-        if ($uri.'/' === $baseUri) {
180
+        if ($uri . '/' === $baseUri) {
181 181
             return '';
182 182
         }
183 183
         // A special case, if the baseUri was accessed without a trailing
184 184
         // slash, we'll accept it as well.
185 185
 
186
-        throw new \LogicException('Requested uri ('.$this->getUrl().') is out of base uri ('.$this->getBaseUrl().')');
186
+        throw new \LogicException('Requested uri (' . $this->getUrl() . ') is out of base uri (' . $this->getBaseUrl() . ')');
187 187
     }
188 188
 
189 189
     /**
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
      */
251 251
     public function __toString(): string
252 252
     {
253
-        $out = $this->getMethod().' '.$this->getUrl().' HTTP/'.$this->getHttpVersion()."\r\n";
253
+        $out = $this->getMethod() . ' ' . $this->getUrl() . ' HTTP/' . $this->getHttpVersion() . "\r\n";
254 254
 
255 255
         foreach ($this->getHeaders() as $key => $value) {
256 256
             foreach ($value as $v) {
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
                     list($v) = explode(' ', $v, 2);
259 259
                     $v .= ' REDACTED';
260 260
                 }
261
-                $out .= $key.': '.$v."\r\n";
261
+                $out .= $key . ': ' . $v . "\r\n";
262 262
             }
263 263
         }
264 264
         $out .= "\r\n";
Please login to merge, or discard this patch.