Test Failed
Push — master ( e18acf...2713a2 )
by Marcio
12:48
created
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.
src/Ballybran/Helpers/Http/Cookie.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  */
18 18
 
19 19
 namespace Ballybran\Helpers\Http;
20
-use Ballybran\Core\Http\{Request , Response , RestUtilities};
20
+use Ballybran\Core\Http\{Request, Response, RestUtilities};
21 21
 
22 22
 
23 23
 /**
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
         if (!is_null($maxage)) {
111 111
             $maxage = intval($maxage);
112
-            $this->data['maxage'] = 'Expires=' .gmdate("D, d M Y H:i:s",  $maxage > 0 ? time() + $maxage : 0)." GMT" . 'Max-Age=' . $maxage;
112
+            $this->data['maxage'] = 'Expires=' . gmdate("D, d M Y H:i:s", $maxage > 0 ? time() + $maxage : 0) . " GMT" . 'Max-Age=' . $maxage;
113 113
         }
114 114
         $this->data['maxage'] = $maxage;
115 115
         return $this;
Please login to merge, or discard this patch.
src/Ballybran/Helpers/Http/FileSystem.php 1 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.