Test Failed
Push — master ( 0748b7...112f34 )
by Marcio
09:50
created
src/Ballybran/Helpers/Utility/Ucfirst.php 1 patch
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.
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/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/RequestBuilder.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.
src/Ballybran/Library/CSSCache.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
         header('Content-Type: text/css; charset: UTF-8');
32 32
         header('Cache-Control: must-revalidate');
33
-        header('Expires: ' . gmdate('D, d M Y H:i:s' , time() + $expire) . ' GMT');
33
+        header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expire) . ' GMT');
34 34
     }
35 35
 
36 36
     public function dump_style()
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         ob_end_flush();
45 45
     }
46 46
 
47
-    private function get_cache_name($filename , $wildcard = FALSE)
47
+    private function get_cache_name($filename, $wildcard = FALSE)
48 48
     {
49 49
         $stat = stat($filename);
50 50
         return $this->cwd . $filename . '.' .
@@ -62,17 +62,17 @@  discard block
 block discarded – undo
62 62
 
63 63
     private function compress($buffer)
64 64
     {
65
-        $buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!' , '' , $buffer);
66
-        $buffer = str_replace(array("\r\n" , "\r" , "\n" , "\t" , '  ') , '' , $buffer);
67
-        $buffer = str_replace('{ ' , '{' , $buffer);
68
-        $buffer = str_replace(' }' , '}' , $buffer);
69
-        $buffer = str_replace('; ' , ';' , $buffer);
70
-        $buffer = str_replace(', ' , ',' , $buffer);
71
-        $buffer = str_replace(' {' , '{' , $buffer);
72
-        $buffer = str_replace('} ' , '}' , $buffer);
73
-        $buffer = str_replace(': ' , ':' , $buffer);
74
-        $buffer = str_replace(',' , ',' , $buffer);
75
-        $buffer = str_replace(' ;' , ';' , $buffer);
65
+        $buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer);
66
+        $buffer = str_replace(array("\r\n", "\r", "\n", "\t", '  '), '', $buffer);
67
+        $buffer = str_replace('{ ', '{', $buffer);
68
+        $buffer = str_replace(' }', '}', $buffer);
69
+        $buffer = str_replace('; ', ';', $buffer);
70
+        $buffer = str_replace(', ', ',', $buffer);
71
+        $buffer = str_replace(' {', '{', $buffer);
72
+        $buffer = str_replace('} ', '}', $buffer);
73
+        $buffer = str_replace(': ', ':', $buffer);
74
+        $buffer = str_replace(',', ',', $buffer);
75
+        $buffer = str_replace(' ;', ';', $buffer);
76 76
         return $buffer;
77 77
     }
78 78
 
@@ -87,13 +87,13 @@  discard block
 block discarded – undo
87 87
         }
88 88
 
89 89
         // remove any old, lingering caches for this file
90
-        if ($dead_files = glob($this->get_cache_name($filename , TRUE) , GLOB_NOESCAPE)) {
90
+        if ($dead_files = glob($this->get_cache_name($filename, TRUE), GLOB_NOESCAPE)) {
91 91
             foreach ($dead_files as $dead_file)
92 92
                 unlink($dead_file);
93 93
         }
94 94
 
95 95
         $compressed = $this->compress(file_get_contents($filename));
96
-        file_put_contents($current_cache , $compressed);
96
+        file_put_contents($current_cache, $compressed);
97 97
 
98 98
         echo $compressed;
99 99
     }
Please login to merge, or discard this patch.
src/Ballybran/Helpers/Form/Form.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -280,7 +280,7 @@
 block discarded – undo
280 280
         if (!is_array($params)) {
281 281
             throw new \InvalidArgumentException("Arguments is not a Array" . print_r($params, true));
282 282
         }
283
-        $o ='';
283
+        $o = '';
284 284
         $o .= (isset($params['id'])) ? " id='{$params['id']}'" : '';
285 285
         $o .= (isset($params['name'])) ? " name='{$params['name']}'" : '';
286 286
         $o .= (isset($params['value'])) ? " value='{$params['value']}'" : '';
Please login to merge, or discard this patch.
src/Ballybran/Core/Http/DigestAuthentication.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
 
69 69
 //user => password
70
-        $users = array('zebedeu' => '1234' , 'guest' => 'guest');
70
+        $users = array('zebedeu' => '1234', 'guest' => 'guest');
71 71
 
72 72
 
73 73
         if (empty($_SERVER['PHP_AUTH_DIGEST'])) {
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
     function http_digest_parse($txt)
100 100
     {
101 101
         // protect against missing data
102
-        $needed_parts = array('nonce' => 1 , 'nc' => 1 , 'cnonce' => 1 , 'qop' => 1 , 'username' => 1 , 'uri' => 1 , 'response' => 1);
102
+        $needed_parts = array('nonce' => 1, 'nc' => 1, 'cnonce' => 1, 'qop' => 1, 'username' => 1, 'uri' => 1, 'response' => 1);
103 103
         $data = array();
104
-        $keys = implode('|' , array_keys($needed_parts));
104
+        $keys = implode('|', array_keys($needed_parts));
105 105
 
106
-        preg_match_all('@(' . $keys . ')=(?:([\'"])([^\2]+?)\2|([^\s,]+))@' , $txt , $matches , PREG_SET_ORDER);
106
+        preg_match_all('@(' . $keys . ')=(?:([\'"])([^\2]+?)\2|([^\s,]+))@', $txt, $matches, PREG_SET_ORDER);
107 107
 
108 108
         foreach ($matches as $m) {
109 109
             $data[$m[1]] = $m[3] ? $m[3] : $m[4];
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
      *
119 119
      */
120 120
 
121
-    public function checkUserPassword($users){
121
+    public function checkUserPassword($users) {
122 122
         $data = $this->http_digest_parse($_SERVER['PHP_AUTH_DIGEST']);
123 123
         var_dump($data);
124
-        if (!($data) || ! isset($users[$data['username']])) {
124
+        if (!($data) || !isset($users[$data['username']])) {
125 125
             die('Wrong Credentials!');
126 126
         }
127 127
         return $data;
Please login to merge, or discard this patch.