Passed
Pull Request — master (#57)
by Marcio
03:36
created
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/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/Helpers/Http/FileSystem.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@
 block discarded – undo
112 112
 
113 113
                 $this->explode = explode('.', $this->name);
114 114
             }
115
-            }else {
115
+            } else {
116 116
                 $this->name = $_FILES[$filename]['name'];
117 117
                 $this->size = $_FILES[$filename]['size'];
118 118
                 $this->type = $_FILES[$filename]['type'];
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     public function __construct(ResizeInterface $image, string $filename = 'archive')
104 104
     {
105 105
         if (!empty($_FILES[$filename])) {
106
-            if(is_array( $_FILES[$filename]['name'])){
106
+            if (is_array($_FILES[$filename]['name'])) {
107 107
             foreach ($_FILES[$filename]['name'] as $i => $name) {
108 108
                 $this->name = $_FILES[$filename]['name'][$i];
109 109
                 $this->size = $_FILES[$filename]['size'][$i];
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 
113 113
                 $this->explode = explode('.', $this->name);
114 114
             }
115
-            }else {
115
+            } else {
116 116
                 $this->name = $_FILES[$filename]['name'];
117 117
                 $this->size = $_FILES[$filename]['size'];
118 118
                 $this->type = $_FILES[$filename]['type'];
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
      * make PathDir If User Exist
133 133
      * @param string $userNamePath
134 134
      */
135
-    public function file($dir_name = null, $userNamePath= null)
135
+    public function file($dir_name = null, $userNamePath = null)
136 136
     {
137 137
         $this->dir = $dir_name;
138 138
         $this->userNamePath = $userNamePath;
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
      */
146 146
     private function make()
147 147
     {
148
-        if ( null == $this->userNamePath ) {
148
+        if (null == $this->userNamePath) {
149 149
             $this->makeDefaultPath();
150 150
             $this->makePathDirIfDefaultFileNotExist();
151 151
             return $this->moveUploadedFile();
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
     private function makePathBayUserName(): String
210 210
     {
211 211
         $this->ext = end($this->explode);
212
-        $this->path = DIR_FILE . 'Upload' . DS. $this->userNamePath . DS . $this->dir . DS;
212
+        $this->path = DIR_FILE . 'Upload' . DS . $this->userNamePath . DS . $this->dir . DS;
213 213
         $this->path .= basename($this->explode[0] . time() . '.' . $this->ext);
214 214
 
215 215
         return $this->path;
Please login to merge, or discard this patch.
src/Ballybran/Library/CSSCache.php 2 patches
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.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -54,8 +54,9 @@  discard block
 block discarded – undo
54 54
     private function style_changed()
55 55
     {
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
     }
@@ -88,8 +89,9 @@  discard block
 block discarded – undo
88 89
 
89 90
         // remove any old, lingering caches for this file
90 91
         if ($dead_files = glob($this->get_cache_name($filename , TRUE) , GLOB_NOESCAPE)) {
91
-            foreach ($dead_files as $dead_file)
92
-                unlink($dead_file);
92
+            foreach ($dead_files as $dead_file) {
93
+                            unlink($dead_file);
94
+            }
93 95
         }
94 96
 
95 97
         $compressed = $this->compress(file_get_contents($filename));
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.