Test Failed
Push — master ( e18acf...2713a2 )
by Marcio
12:48
created
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.
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.
src/Ballybran/Core/View/ViewrInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 
22 22
 interface ViewrInterface
23 23
 {
24
-    public function render(object $controller , string $view);
24
+    public function render(object $controller, string $view);
25 25
 
26 26
     public function fetch($data = null);
27 27
 
Please login to merge, or discard this patch.
src/Ballybran/Core/View/View.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@
 block discarded – undo
96 96
 
97 97
     public function add(array $data) : void
98 98
     {
99
-        $this->data = array_merge( $this->data, $data );
99
+        $this->data = array_merge($this->data, $data);
100 100
 
101 101
     }
102 102
 
Please login to merge, or discard this patch.
src/Ballybran/Core/Collections/Collection/ValidateDot.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -180,16 +180,16 @@
 block discarded – undo
180 180
      */
181 181
     public function merge($key, $value = null)
182 182
     {
183
-        if (is_array( $key )) {
184
-            $this->elements = array_merge( $this->elements , $key );
183
+        if (is_array($key)) {
184
+            $this->elements = array_merge($this->elements, $key);
185 185
         }
186
-        if (is_string( $key )) {
187
-            $items = (array)$this->get( $key );
188
-            $value = array_merge( $items , $this->getArrayItems( $value ) );
189
-            $this->set( $key , $value );
186
+        if (is_string($key)) {
187
+            $items = (array)$this->get($key);
188
+            $value = array_merge($items, $this->getArrayItems($value));
189
+            $this->set($key, $value);
190 190
         }
191
-        if (is_object( $key ) || $key instanceof IteratorDot) {
192
-            $this->elements = array_merge( $this->elements , $key->all() );
191
+        if (is_object($key) || $key instanceof IteratorDot) {
192
+            $this->elements = array_merge($this->elements, $key->all());
193 193
         }
194 194
     }
195 195
 }
196 196
\ No newline at end of file
Please login to merge, or discard this patch.
src/Ballybran/Database/QueryBuilder.php 1 patch
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -42,13 +42,13 @@  discard block
 block discarded – undo
42 42
      * @param $arguments
43 43
      * @return $this
44 44
      */
45
-    function __call($name , $arguments)
45
+    function __call($name, $arguments)
46 46
     {
47 47
         $clausule = $arguments[0];
48
-        if (count( $arguments ) > 1) {
48
+        if (count($arguments) > 1) {
49 49
             $clausule = $arguments;
50 50
         }
51
-        $this->clausules[strtolower( $name )] = $clausule;
51
+        $this->clausules[strtolower($name)] = $clausule;
52 52
 
53 53
         return $this;
54 54
     }
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      */
60 60
     public function __construct(array $options)
61 61
     {
62
-        parent::__construct( $options );
62
+        parent::__construct($options);
63 63
         $this->conn = $this->connection();
64 64
 
65 65
     }
@@ -68,15 +68,15 @@  discard block
 block discarded – undo
68 68
      * @param array $values
69 69
      * @return string
70 70
      */
71
-    public function insert(array $values = [] )
71
+    public function insert(array $values = [])
72 72
     {
73 73
         // recupera o nome da tabela
74 74
         // ou deixa uma marcação para mostrar que faltou informar esse campo
75
-        $table = isset( $this->clausules['table'] ) ? $this->clausules['table'] : '<table>';
75
+        $table = isset($this->clausules['table']) ? $this->clausules['table'] : '<table>';
76 76
 
77 77
         // recupera o array dos campos
78 78
         // ou deixa uma marcação para mostrar que faltou informar esse campo
79
-        $_fields = isset( $this->clausules['fields'] ) ? $this->clausules['fields'] : '<fields>';
79
+        $_fields = isset($this->clausules['fields']) ? $this->clausules['fields'] : '<fields>';
80 80
 //        $fields = implode( ', ' , $_fields );
81 81
 //
82 82
 //        // cria uma lista de rótulos para usar "prepared statement"
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
 
101 101
         // INSERT INTO {table} ({fields}) VALUES ({values});
102 102
         // junta o comando
103
-        $sql = implode( ' ' , $command );
103
+        $sql = implode(' ', $command);
104 104
 
105
-        return $this->executeInsert( $sql , $values );
105
+        return $this->executeInsert($sql, $values);
106 106
     }
107 107
 
108 108
     /**
@@ -113,14 +113,14 @@  discard block
 block discarded – undo
113 113
     {
114 114
         // recupera o nome da tabela
115 115
         // ou deixa uma marcação para mostrar que faltou informar esse campo
116
-        $table = isset( $this->clausules['table'] ) ? $this->clausules['table'] : '<table>';
116
+        $table = isset($this->clausules['table']) ? $this->clausules['table'] : '<table>';
117 117
 
118 118
         // recupera o array dos campos
119 119
         // ou deixa uma marcação para mostrar que faltou informar esse campo
120
-        $_fields = isset( $this->clausules['fields'] ) ? $this->clausules['fields'] : '*';
121
-        $fields = implode( ', ' , $_fields );
120
+        $_fields = isset($this->clausules['fields']) ? $this->clausules['fields'] : '*';
121
+        $fields = implode(', ', $_fields);
122 122
 
123
-        $join = isset( $this->clausules['join'] ) ? $this->clausules['join'] : '';
123
+        $join = isset($this->clausules['join']) ? $this->clausules['join'] : '';
124 124
 
125 125
         $command = [];
126 126
         $command[] = 'SELECT';
@@ -133,31 +133,31 @@  discard block
 block discarded – undo
133 133
 
134 134
         $clausules = [
135 135
             'where' => [
136
-                'instruction' => 'WHERE' ,
137
-                'separator' => ' ' ,
138
-            ] ,
136
+                'instruction' => 'WHERE',
137
+                'separator' => ' ',
138
+            ],
139 139
             'group' => [
140
-                'instruction' => 'GROUP BY' ,
141
-                'separator' => ', ' ,
142
-            ] ,
140
+                'instruction' => 'GROUP BY',
141
+                'separator' => ', ',
142
+            ],
143 143
             'order' => [
144
-                'instruction' => 'ORDER BY' ,
145
-                'separator' => ', ' ,
146
-            ] ,
144
+                'instruction' => 'ORDER BY',
145
+                'separator' => ', ',
146
+            ],
147 147
             'having' => [
148
-                'instruction' => 'HAVING' ,
149
-                'separator' => ' AND ' ,
150
-            ] ,
148
+                'instruction' => 'HAVING',
149
+                'separator' => ' AND ',
150
+            ],
151 151
             'limit' => [
152
-                'instruction' => 'LIMIT' ,
153
-                'separator' => ',' ,
154
-            ] ,
152
+                'instruction' => 'LIMIT',
153
+                'separator' => ',',
154
+            ],
155 155
         ];
156 156
         foreach ($clausules as $key => $clausule) {
157
-            if (isset( $this->clausules[$key] )) {
157
+            if (isset($this->clausules[$key])) {
158 158
                 $value = $this->clausules[$key];
159
-                if (is_array( $value )) {
160
-                    $value = implode( $clausule['separator'] , $this->clausules[$key] );
159
+                if (is_array($value)) {
160
+                    $value = implode($clausule['separator'], $this->clausules[$key]);
161 161
                 }
162 162
                 $command[] = $clausule['instruction'] . ' ' . $value;
163 163
             }
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
 
166 166
         // SELECT {fields} FROM <JOIN> {table} <WHERE> <GROUP> <ORDER> <HAVING> <LIMIT>;
167 167
         // junta o comando
168
-        $sql = implode( ' ' , $command );
168
+        $sql = implode(' ', $command);
169 169
         var_dump($sql);
170 170
 
171
-        return $this->executeSelect( $sql , $values );
171
+        return $this->executeSelect($sql, $values);
172 172
     }
173 173
 
174 174
     /**
@@ -178,13 +178,13 @@  discard block
 block discarded – undo
178 178
     {
179 179
         // recupera o nome da tabela
180 180
         // ou deixa uma marcação para mostrar que faltou informar esse campo
181
-        $table = isset( $this->clausules['table'] ) ? $this->clausules['table'] : '<table>';
181
+        $table = isset($this->clausules['table']) ? $this->clausules['table'] : '<table>';
182 182
 
183
-        $join = isset( $this->clausules['join'] ) ? $this->clausules['join'] : '';
183
+        $join = isset($this->clausules['join']) ? $this->clausules['join'] : '';
184 184
 
185 185
         // recupera o array dos campos
186 186
         // ou deixa uma marcação para mostrar que faltou informar esse campo
187
-        $_fields = isset( $this->clausules['fields'] ) ? $this->clausules['fields'] : '<fields>';
187
+        $_fields = isset($this->clausules['fields']) ? $this->clausules['fields'] : '<fields>';
188 188
 
189 189
 
190 190
         ksort($_fields);
@@ -208,19 +208,19 @@  discard block
 block discarded – undo
208 208
 
209 209
         $clausules = [
210 210
             'where' => [
211
-                'instruction' => 'WHERE' ,
212
-                'separator' => ' ' ,
211
+                'instruction' => 'WHERE',
212
+                'separator' => ' ',
213 213
             ],
214 214
             'limit' => [
215
-                'instruction' => 'LIMIT' ,
216
-                'separator' => ',' ,
217
-            ] ,
215
+                'instruction' => 'LIMIT',
216
+                'separator' => ',',
217
+            ],
218 218
         ];
219 219
         foreach ($clausules as $key => $clausule) {
220
-            if (isset( $this->clausules[$key] )) {
220
+            if (isset($this->clausules[$key])) {
221 221
                 $value = $this->clausules[$key];
222
-                if (is_array( $value )) {
223
-                    $value = implode( $clausule['separator'] , $this->clausules[$key] );
222
+                if (is_array($value)) {
223
+                    $value = implode($clausule['separator'], $this->clausules[$key]);
224 224
                 }
225 225
                 $command[] = $clausule['instruction'] . ' ' . $value;
226 226
             }
@@ -228,22 +228,22 @@  discard block
 block discarded – undo
228 228
 
229 229
         // UPDATE {table} SET {set} <WHERE>
230 230
         // junta o comando
231
-        $sql = implode( ' ' , $command );
231
+        $sql = implode(' ', $command);
232 232
 
233
-        return $this->executeUpdate( $sql , $_fields );
233
+        return $this->executeUpdate($sql, $_fields);
234 234
     }
235 235
 
236 236
     /**
237 237
      * @param $filters
238 238
      * @return int
239 239
      */
240
-    public function delete($filters = null )
240
+    public function delete($filters = null)
241 241
     {
242 242
         // recupera o nome da tabela
243 243
         // ou deixa uma marcação para mostrar que faltou informar esse campo
244
-        $table = isset( $this->clausules['table'] ) ? $this->clausules['table'] : '<table>';
244
+        $table = isset($this->clausules['table']) ? $this->clausules['table'] : '<table>';
245 245
 
246
-        $join = isset( $this->clausules['join'] ) ? $this->clausules['join'] : '';
246
+        $join = isset($this->clausules['join']) ? $this->clausules['join'] : '';
247 247
 
248 248
         $command = [];
249 249
         $command[] = 'DELETE FROM';
@@ -254,20 +254,20 @@  discard block
 block discarded – undo
254 254
 
255 255
         $clausules = [
256 256
             'where' => [
257
-                'instruction' => 'WHERE' ,
258
-                'separator' => ' ' ,
257
+                'instruction' => 'WHERE',
258
+                'separator' => ' ',
259 259
             ],
260 260
             'limit' => [
261
-                'instruction' => 'LIMIT' ,
262
-                'separator' => ',' ,
263
-            ] ,
261
+                'instruction' => 'LIMIT',
262
+                'separator' => ',',
263
+            ],
264 264
 
265 265
         ];
266 266
         foreach ($clausules as $key => $clausule) {
267
-            if (isset( $this->clausules[$key] )) {
267
+            if (isset($this->clausules[$key])) {
268 268
                 $value = $this->clausules[$key];
269
-                if (is_array( $value )) {
270
-                    $value = implode( $clausule['separator'] , $this->clausules[$key] );
269
+                if (is_array($value)) {
270
+                    $value = implode($clausule['separator'], $this->clausules[$key]);
271 271
                 }
272 272
                 $command[] = $clausule['instruction'] . ' ' . $value;
273 273
             }
@@ -275,30 +275,30 @@  discard block
 block discarded – undo
275 275
 
276 276
         // DELETE FROM {table} <JOIN> <USING> <WHERE>
277 277
         // junta o comando
278
-        $sql = implode( ' ' , $command );
278
+        $sql = implode(' ', $command);
279 279
 
280
-        return $this->executeDelete( $sql , $filters );
280
+        return $this->executeDelete($sql, $filters);
281 281
     }
282 282
 
283
-    private function executeSelect($sql , $value)
283
+    private function executeSelect($sql, $value)
284 284
     {
285 285
 
286
-        $stmt = $this->conn->prepare( $sql );
286
+        $stmt = $this->conn->prepare($sql);
287 287
 
288 288
         foreach ($value as $key => $values) {
289
-            return $stmt->bindValue( "$key" , $values );
289
+            return $stmt->bindValue("$key", $values);
290 290
         }
291 291
         $stmt->execute();
292 292
 
293 293
         do {
294
-            return $stmt->fetchAll( $fetchMode );
294
+            return $stmt->fetchAll($fetchMode);
295 295
         } while (
296 296
             $stmt->nextRowset());
297 297
         $stmt->close();
298 298
 
299 299
     }
300 300
 
301
-    private function executeInsert($sql , $value)
301
+    private function executeInsert($sql, $value)
302 302
     {
303 303
         try {
304 304
 
@@ -306,11 +306,11 @@  discard block
 block discarded – undo
306 306
 
307 307
             $stmt = $this->conn->prepare($sql);
308 308
             foreach ($value as $key => $values) {
309
-                $stmt->bindValue( ":$key" , $values );
309
+                $stmt->bindValue(":$key", $values);
310 310
             }
311 311
             $this->_commit();
312 312
             $stmt->execute();
313
-            unset( $stmt );
313
+            unset($stmt);
314 314
         } catch (\Exception $e) {
315 315
             $this->_Rollback();
316 316
             echo 'error insert ' . $e->getMessage();
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
     }
320 320
 
321 321
 
322
-    private function executeUpdate($sql , $data)
322
+    private function executeUpdate($sql, $data)
323 323
     {
324 324
         $stmt = $this->conn->prepare($sql);
325 325
         foreach ($data as $key => $values) {
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
         return $stmt->execute();
330 330
     }
331 331
 
332
-    private function executeDelete($sql , $value)
332
+    private function executeDelete($sql, $value)
333 333
     {
334 334
         return $this->conn->exec($sql);
335 335
 
Please login to merge, or discard this patch.
src/Ballybran/Database/MySQLDump.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
     public function save($file)
59 59
     {
60 60
         $this->createWritableFolder($file);
61
-        $file = DIR_STORAGE. $file;
61
+        $file = DIR_STORAGE . $file;
62 62
         $handle = strcasecmp(substr($file, -3), '.gz') ? fopen($file, 'wb') : gzopen($file, 'wb');
63 63
         if (!$handle) {
64 64
             throw new \Exception("ERROR: Cannot write file '$file'.");
Please login to merge, or discard this patch.
src/Ballybran/Helpers/Security/Session.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,10 +43,10 @@
 block discarded – undo
43 43
         }
44 44
 
45 45
         $id = session_id();
46
-        if (empty( $id )) {
46
+        if (empty($id)) {
47 47
             @session_start(
48 48
                 [
49
-                    'cookie_lifetime' => 86400 ,
49
+                    'cookie_lifetime' => 86400,
50 50
 //            'read_and_close'  => true,
51 51
                 ]
52 52
             );
Please login to merge, or discard this patch.