Passed
Branch master (092323)
by Glegrith
02:14
created
app/framework/Component/Database/Connection/Driver.php 2 patches
Spacing   +30 added lines, -31 removed lines patch added patch discarded remove patch
@@ -25,16 +25,16 @@  discard block
 block discarded – undo
25 25
 
26 26
         $attr = [
27 27
             'driver' => Driver::MySql,
28
-            'dbname' => $config['database']
28
+            'dbname' => $config[ 'database' ]
29 29
         ];
30 30
 
31
-        if (isset($config['socket'])) {
32
-            $attr['unix_socket'] = $config['socket'];
31
+        if (isset($config[ 'socket' ])) {
32
+            $attr[ 'unix_socket' ] = $config[ 'socket' ];
33 33
         } else {
34
-            $attr['host'] = $config['host'];
34
+            $attr[ 'host' ] = $config[ 'host' ];
35 35
 
36
-            if (isset($config["port"]))
37
-                $attr['port'] = $config["port"];
36
+            if (isset($config[ "port" ]))
37
+                $attr[ 'port' ] = $config[ "port" ];
38 38
         }
39 39
 
40 40
         self::parseDsn($dsn, $attr);
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
 
48 48
         $attr = [
49 49
             'driver' => Driver::PgSql,
50
-            'host' => $config['host'],
51
-            'dbname' => $config['database']
50
+            'host' => $config[ 'host' ],
51
+            'dbname' => $config[ 'database' ]
52 52
         ];
53 53
 
54
-        if (isset($config["port"]))
55
-            $attr['port'] = $config["port"];
54
+        if (isset($config[ "port" ]))
55
+            $attr[ 'port' ] = $config[ "port" ];
56 56
 
57 57
         self::parseDsn($dsn, $attr);
58 58
         return $dsn;
@@ -64,12 +64,12 @@  discard block
 block discarded – undo
64 64
 
65 65
         $attr = [
66 66
             'driver' => Driver::DbLib,
67
-            'host' => $config['host'],
68
-            'dbname' => $config['database']
67
+            'host' => $config[ 'host' ],
68
+            'dbname' => $config[ 'database' ]
69 69
         ];
70 70
 
71
-        if (isset($config["port"]))
72
-            $attr['port'] = $config["port"];
71
+        if (isset($config[ "port" ]))
72
+            $attr[ 'port' ] = $config[ "port" ];
73 73
 
74 74
         self::parseDsn($dsn, $attr);
75 75
         return $dsn;
@@ -81,13 +81,12 @@  discard block
 block discarded – undo
81 81
 
82 82
         $attr = [
83 83
             'driver' => 'oci',
84
-            'dbname' => $config['server'] ?
85
-                '//' . $config['server'] . (isset($config["port"]) ? ':' . $config["port"] : ':1521') . '/' . $config['database'] :
86
-                $config['database']
84
+            'dbname' => $config[ 'server' ] ?
85
+                '//'.$config[ 'server' ].(isset($config[ "port" ]) ? ':'.$config[ "port" ] : ':1521').'/'.$config[ 'database' ] : $config[ 'database' ]
87 86
         ];
88 87
 
89
-        if (isset($config['charset']))
90
-            $attr['charset'] = $config['charset'];
88
+        if (isset($config[ 'charset' ]))
89
+            $attr[ 'charset' ] = $config[ 'charset' ];
91 90
 
92 91
         self::parseDsn($dsn, $attr);
93 92
         return $dsn;
@@ -100,19 +99,19 @@  discard block
 block discarded – undo
100 99
         if (strstr(PHP_OS, 'WIN')) {
101 100
             $attr = [
102 101
                 'driver' => 'sqlsrv',
103
-                'server' => $config['server'],
104
-                'database' => $config['database']
102
+                'server' => $config[ 'server' ],
103
+                'database' => $config[ 'database' ]
105 104
             ];
106 105
         } else {
107 106
             $attr = [
108 107
                 'driver' => 'dblib',
109
-                'host' => $config['host'],
110
-                'dbname' => $config['database']
108
+                'host' => $config[ 'host' ],
109
+                'dbname' => $config[ 'database' ]
111 110
             ];
112 111
         }
113 112
 
114
-        if (isset($config["port"]))
115
-            $attr['port'] = $config["port"];
113
+        if (isset($config[ "port" ]))
114
+            $attr[ 'port' ] = $config[ "port" ];
116 115
 
117 116
         self::parseDsn($dsn, $attr);
118 117
         return $dsn;
@@ -128,18 +127,18 @@  discard block
 block discarded – undo
128 127
 
129 128
     private static function parseDsn(&$dsn, $attr)
130 129
     {
131
-        $driver = $attr['driver'];
132
-        unset($attr['driver']);
130
+        $driver = $attr[ 'driver' ];
131
+        unset($attr[ 'driver' ]);
133 132
 
134
-        $stack = [];
133
+        $stack = [ ];
135 134
 
136 135
         foreach ($attr as $key => $value) {
137 136
             if (is_int($key))
138
-                $stack[] = $value;
137
+                $stack[ ] = $value;
139 138
             else
140
-                $stack[] = $key . '=' . $value;
139
+                $stack[ ] = $key.'='.$value;
141 140
         }
142 141
 
143
-        $dsn = $driver . ':' . implode($stack, ';');
142
+        $dsn = $driver.':'.implode($stack, ';');
144 143
     }
145 144
 }
Please login to merge, or discard this patch.
Braces   +20 added lines, -14 removed lines patch added patch discarded remove patch
@@ -33,8 +33,9 @@  discard block
 block discarded – undo
33 33
         } else {
34 34
             $attr['host'] = $config['host'];
35 35
 
36
-            if (isset($config["port"]))
37
-                $attr['port'] = $config["port"];
36
+            if (isset($config["port"])) {
37
+                            $attr['port'] = $config["port"];
38
+            }
38 39
         }
39 40
 
40 41
         self::parseDsn($dsn, $attr);
@@ -51,8 +52,9 @@  discard block
 block discarded – undo
51 52
             'dbname' => $config['database']
52 53
         ];
53 54
 
54
-        if (isset($config["port"]))
55
-            $attr['port'] = $config["port"];
55
+        if (isset($config["port"])) {
56
+                    $attr['port'] = $config["port"];
57
+        }
56 58
 
57 59
         self::parseDsn($dsn, $attr);
58 60
         return $dsn;
@@ -68,8 +70,9 @@  discard block
 block discarded – undo
68 70
             'dbname' => $config['database']
69 71
         ];
70 72
 
71
-        if (isset($config["port"]))
72
-            $attr['port'] = $config["port"];
73
+        if (isset($config["port"])) {
74
+                    $attr['port'] = $config["port"];
75
+        }
73 76
 
74 77
         self::parseDsn($dsn, $attr);
75 78
         return $dsn;
@@ -86,8 +89,9 @@  discard block
 block discarded – undo
86 89
                 $config['database']
87 90
         ];
88 91
 
89
-        if (isset($config['charset']))
90
-            $attr['charset'] = $config['charset'];
92
+        if (isset($config['charset'])) {
93
+                    $attr['charset'] = $config['charset'];
94
+        }
91 95
 
92 96
         self::parseDsn($dsn, $attr);
93 97
         return $dsn;
@@ -111,8 +115,9 @@  discard block
 block discarded – undo
111 115
             ];
112 116
         }
113 117
 
114
-        if (isset($config["port"]))
115
-            $attr['port'] = $config["port"];
118
+        if (isset($config["port"])) {
119
+                    $attr['port'] = $config["port"];
120
+        }
116 121
 
117 122
         self::parseDsn($dsn, $attr);
118 123
         return $dsn;
@@ -134,10 +139,11 @@  discard block
 block discarded – undo
134 139
         $stack = [];
135 140
 
136 141
         foreach ($attr as $key => $value) {
137
-            if (is_int($key))
138
-                $stack[] = $value;
139
-            else
140
-                $stack[] = $key . '=' . $value;
142
+            if (is_int($key)) {
143
+                            $stack[] = $value;
144
+            } else {
145
+                            $stack[] = $key . '=' . $value;
146
+            }
141 147
         }
142 148
 
143 149
         $dsn = $driver . ':' . implode($stack, ';');
Please login to merge, or discard this patch.
app/framework/Component/Database/Schema/Schema.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@
 block discarded – undo
67 67
 */
68 68
     private static function init(string $connection = null)
69 69
     {
70
-        if(is_null(self::$Medoo))
70
+        if (is_null(self::$Medoo))
71 71
             self::$Medoo = new Medoo($connection);
72 72
     }
73 73
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,7 +67,8 @@
 block discarded – undo
67 67
 */
68 68
     private static function init(string $connection = null)
69 69
     {
70
-        if(is_null(self::$Medoo))
71
-            self::$Medoo = new Medoo($connection);
70
+        if(is_null(self::$Medoo)) {
71
+                    self::$Medoo = new Medoo($connection);
72
+        }
72 73
     }
73 74
 }
Please login to merge, or discard this patch.
app/framework/Component/Database/Schema/Blueprint.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      *
28 28
      * @var Column[]
29 29
      */
30
-    private $columns = [];
30
+    private $columns = [ ];
31 31
 
32 32
     /**
33 33
      * @var string
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     public function boolean($name)
74 74
     {
75 75
         $tempColumn = new Column($name, 'BOOLEAN');
76
-        $this->columns[] = $tempColumn;
76
+        $this->columns[ ] = $tempColumn;
77 77
     }
78 78
 
79 79
     /**
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
         $tempColumn = new Column($name, 'DECIMAL');
88 88
         $tempColumn->length = $precision;
89 89
         $tempColumn->scale = $scale;
90
-        $this->columns[] = $tempColumn;
90
+        $this->columns[ ] = $tempColumn;
91 91
     }
92 92
 
93 93
     /**
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         $tempColumn = new Column($name, 'DOUBLE');
102 102
         $tempColumn->length = $precision;
103 103
         $tempColumn->scale = $scale;
104
-        $this->columns[] = $tempColumn;
104
+        $this->columns[ ] = $tempColumn;
105 105
     }
106 106
 
107 107
     /**
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
         $tempColumn = new Column($name, 'FLOAT');
116 116
         $tempColumn->length = $precision;
117 117
         $tempColumn->scale = $scale;
118
-        $this->columns[] = $tempColumn;
118
+        $this->columns[ ] = $tempColumn;
119 119
     }
120 120
 
121 121
     /**
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
     public function integer($name)
127 127
     {
128 128
         $tempColumn = new Column($name, 'INTEGER');
129
-        $this->columns[] = $tempColumn;
129
+        $this->columns[ ] = $tempColumn;
130 130
     }
131 131
 
132 132
     /**
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
     public function mediumInteger($name)
138 138
     {
139 139
         $tempColumn = new Column($name, 'MEDIUMINT');
140
-        $this->columns[] = $tempColumn;
140
+        $this->columns[ ] = $tempColumn;
141 141
     }
142 142
 
143 143
     /**
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
     public function bigInteger($name)
149 149
     {
150 150
         $tempColumn = new Column($name, 'BIGINT');
151
-        $this->columns[] = $tempColumn;
151
+        $this->columns[ ] = $tempColumn;
152 152
     }
153 153
 
154 154
     /**
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
         $tempColumn->isAutoIncrement = true;
163 163
         $tempColumn->isPrimaryKey    = true;
164 164
         $tempColumn->isUnsigned      = true;
165
-        $this->columns[] = $tempColumn;
165
+        $this->columns[ ] = $tempColumn;
166 166
     }
167 167
 
168 168
     /**
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
         $tempColumn->isAutoIncrement = true;
177 177
         $tempColumn->isPrimaryKey    = true;
178 178
         $tempColumn->isUnsigned      = true;
179
-        $this->columns[] = $tempColumn;
179
+        $this->columns[ ] = $tempColumn;
180 180
     }
181 181
 
182 182
     /**
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
     {
190 190
         $tempColumn = new Column($name, 'VARCHAR');
191 191
         $tempColumn->length = $length;
192
-        $this->columns[] = $tempColumn;
192
+        $this->columns[ ] = $tempColumn;
193 193
     }
194 194
 
195 195
     /**
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
     {
203 203
         $tempColumn = new Column($name, 'CHAR');
204 204
         $tempColumn->length = $length;
205
-        $this->columns[] = $tempColumn;
205
+        $this->columns[ ] = $tempColumn;
206 206
     }
207 207
 
208 208
     /**
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
     public function text($name)
214 214
     {
215 215
         $tempColumn = new Column($name, 'TEXT');
216
-        $this->columns[] = $tempColumn;
216
+        $this->columns[ ] = $tempColumn;
217 217
     }
218 218
 
219 219
     /**
@@ -235,13 +235,13 @@  discard block
 block discarded – undo
235 235
     {
236 236
         $tempColumn = new Column($name, 'TIMESTAMP');
237 237
         $tempColumn->isNull = $isNullable;
238
-        $this->columns[] = $tempColumn;
238
+        $this->columns[ ] = $tempColumn;
239 239
     }
240 240
 
241 241
     /**
242 242
      * TIMESTAMP (with timezone) equivalent column.
243 243
      */
244
-    public function timestampTz(){}
244
+    public function timestampTz() {}
245 245
 
246 246
     /**
247 247
      * YEAR equivalent column.
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
     public function year($name)
252 252
     {
253 253
         $tempColumn = new Column($name, 'YEAR');
254
-        $this->columns[] = $tempColumn;
254
+        $this->columns[ ] = $tempColumn;
255 255
     }
256 256
 
257 257
     /**
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
     public function date($name)
263 263
     {
264 264
         $tempColumn = new Column($name, 'DATE');
265
-        $this->columns[] = $tempColumn;
265
+        $this->columns[ ] = $tempColumn;
266 266
     }
267 267
 
268 268
     /**
@@ -273,13 +273,13 @@  discard block
 block discarded – undo
273 273
     public function dateTime($name)
274 274
     {
275 275
         $tempColumn = new Column($name, 'DATETIME');
276
-        $this->columns[] = $tempColumn;
276
+        $this->columns[ ] = $tempColumn;
277 277
     }
278 278
 
279 279
     /**
280 280
      * DATETIME (with timezone) equivalent column.
281 281
      */
282
-    public function dateTimeTz(){}
282
+    public function dateTimeTz() {}
283 283
 
284 284
     /**
285 285
      * TIME equivalent column.
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
     public function time($name)
290 290
     {
291 291
         $tempColumn = new Column($name, 'TIME');
292
-        $this->columns[] = $tempColumn;
292
+        $this->columns[ ] = $tempColumn;
293 293
     }
294 294
 
295 295
     /**
@@ -300,6 +300,6 @@  discard block
 block discarded – undo
300 300
     public function binary($name)
301 301
     {
302 302
         $tempColumn = new Column($name, 'BLOB ');
303
-        $this->columns[] = $tempColumn;
303
+        $this->columns[ ] = $tempColumn;
304 304
     }
305 305
 }
Please login to merge, or discard this patch.
app/framework/Component/Database/Schema/Builder.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -34,29 +34,29 @@
 block discarded – undo
34 34
 
35 35
             $query .= $Column->type;
36 36
 
37
-            if(isset($Column->length))
37
+            if (isset($Column->length))
38 38
                 $query .= "(".$Column->length;
39 39
 
40
-            if(isset($Column->scale) && isset($Column->length)) {
40
+            if (isset($Column->scale) && isset($Column->length)) {
41 41
                 $query .= ", ".$Column->scale.")";
42 42
             } else {
43
-                if(isset($Column->length))
43
+                if (isset($Column->length))
44 44
                     $query .= ")";
45 45
             }
46 46
 
47
-            if($Column->isUnsigned)
47
+            if ($Column->isUnsigned)
48 48
                 $query .= " UNSIGNED";
49 49
 
50
-            if($Column->isNull)
50
+            if ($Column->isNull)
51 51
                 $query .= " NOT NULL";
52 52
 
53
-            if($Column->isAutoIncrement)
53
+            if ($Column->isAutoIncrement)
54 54
                 $query .= " AUTO_INCREMENT";
55 55
 
56
-            if($Column->isPrimaryKey)
56
+            if ($Column->isPrimaryKey)
57 57
                 $query .= " PRIMARY KEY";
58 58
 
59
-            if(count($table->getColumns())-1 != $key)
59
+            if (count($table->getColumns()) - 1 != $key)
60 60
                 $query .= ", ";
61 61
         }
62 62
         $query .= ");";
Please login to merge, or discard this patch.
Braces   +21 added lines, -14 removed lines patch added patch discarded remove patch
@@ -34,30 +34,37 @@
 block discarded – undo
34 34
 
35 35
             $query .= $Column->type;
36 36
 
37
-            if(isset($Column->length))
38
-                $query .= "(".$Column->length;
37
+            if(isset($Column->length)) {
38
+                            $query .= "(".$Column->length;
39
+            }
39 40
 
40 41
             if(isset($Column->scale) && isset($Column->length)) {
41 42
                 $query .= ", ".$Column->scale.")";
42 43
             } else {
43
-                if(isset($Column->length))
44
-                    $query .= ")";
44
+                if(isset($Column->length)) {
45
+                                    $query .= ")";
46
+                }
45 47
             }
46 48
 
47
-            if($Column->isUnsigned)
48
-                $query .= " UNSIGNED";
49
+            if($Column->isUnsigned) {
50
+                            $query .= " UNSIGNED";
51
+            }
49 52
 
50
-            if($Column->isNull)
51
-                $query .= " NOT NULL";
53
+            if($Column->isNull) {
54
+                            $query .= " NOT NULL";
55
+            }
52 56
 
53
-            if($Column->isAutoIncrement)
54
-                $query .= " AUTO_INCREMENT";
57
+            if($Column->isAutoIncrement) {
58
+                            $query .= " AUTO_INCREMENT";
59
+            }
55 60
 
56
-            if($Column->isPrimaryKey)
57
-                $query .= " PRIMARY KEY";
61
+            if($Column->isPrimaryKey) {
62
+                            $query .= " PRIMARY KEY";
63
+            }
58 64
 
59
-            if(count($table->getColumns())-1 != $key)
60
-                $query .= ", ";
65
+            if(count($table->getColumns())-1 != $key) {
66
+                            $query .= ", ";
67
+            }
61 68
         }
62 69
         $query .= ");";
63 70
 
Please login to merge, or discard this patch.
app/framework/Component/ClassLoader/ClassLoader.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@  discard block
 block discarded – undo
10 10
 
11 11
 use app\framework\Component\ClassLoader\Loader;
12 12
 
13
-require_once __DIR__ . "/Loader/Psr0.php";
14
-require_once __DIR__ . "/Loader/Psr4.php";
13
+require_once __DIR__."/Loader/Psr0.php";
14
+require_once __DIR__."/Loader/Psr4.php";
15 15
 
16 16
 class ClassLoader
17 17
 {
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 
23 23
     public function getClass($class)
24 24
     {
25
-        if($file = $this->loadClass($class)){
25
+        if ($file = $this->loadClass($class)) {
26 26
             require($file);
27 27
 
28 28
             return true;
Please login to merge, or discard this patch.
app/framework/Component/ClassLoader/Loader/Psr0.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 namespace app\framework\Component\ClassLoader\Loader;
10 10
 
11
-require __DIR__ . "/AbstractLoader.php";
11
+require __DIR__."/AbstractLoader.php";
12 12
 
13 13
 /**
14 14
  * Psr0 autoloader
@@ -25,11 +25,11 @@  discard block
 block discarded – undo
25 25
         if ($lastNsPos = strrpos($className, '\\')) {
26 26
             $namespace = substr($className, 0, $lastNsPos);
27 27
             $className = substr($className, $lastNsPos + 1);
28
-            $fileName  = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
28
+            $fileName  = str_replace('\\', DIRECTORY_SEPARATOR, $namespace).DIRECTORY_SEPARATOR;
29 29
         }
30
-        $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
30
+        $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className).'.php';
31 31
 
32
-        if(file_exists(ROOT_PATH.DIRECTORY_SEPARATOR.$fileName))
32
+        if (file_exists(ROOT_PATH.DIRECTORY_SEPARATOR.$fileName))
33 33
             return ROOT_PATH.DIRECTORY_SEPARATOR.$fileName;
34 34
 
35 35
         return false;
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,8 +29,9 @@
 block discarded – undo
29 29
         }
30 30
         $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
31 31
 
32
-        if(file_exists(ROOT_PATH.DIRECTORY_SEPARATOR.$fileName))
33
-            return ROOT_PATH.DIRECTORY_SEPARATOR.$fileName;
32
+        if(file_exists(ROOT_PATH.DIRECTORY_SEPARATOR.$fileName)) {
33
+                    return ROOT_PATH.DIRECTORY_SEPARATOR.$fileName;
34
+        }
34 35
 
35 36
         return false;
36 37
     }
Please login to merge, or discard this patch.
app/framework/Component/Encryption/Encrypter.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
     public function __construct($key, $cipher = Ciphers::AES_128_CBC)
31 31
     {
32
-        $key = (string)$key;
32
+        $key = (string) $key;
33 33
 
34 34
         if (static::supported($key, $cipher)) {
35 35
             $this->key    = $key;
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
     {
122 122
         $payload = $this->getJsonPayload($payload);
123 123
 
124
-        $iv = base64_decode($payload['iv']);
124
+        $iv = base64_decode($payload[ 'iv' ]);
125 125
 
126 126
         // Here we will decrypt the value. If we are able to successfully decrypt it
127 127
         // we will then unserialize it and return it out to the caller. If we are
128 128
         // unable to decrypt this value we will throw out an exception message.
129 129
         $decrypted = \openssl_decrypt(
130
-            $payload['value'], $this->cipher, $this->key, 0, $iv
130
+            $payload[ 'value' ], $this->cipher, $this->key, 0, $iv
131 131
         );
132 132
 
133 133
         if ($decrypted === false) {
@@ -169,11 +169,11 @@  discard block
 block discarded – undo
169 169
         // If the payload is not valid JSON or does not have the proper keys set we will
170 170
         // assume it is invalid and bail out of the routine since we will not be able
171 171
         // to decrypt the given value. We'll also check the MAC for this encryption.
172
-        if (! $this->validPayload($payload)) {
172
+        if (!$this->validPayload($payload)) {
173 173
             throw new DecryptException('The payload is invalid.');
174 174
         }
175 175
 
176
-        if (! $this->validMac($payload)) {
176
+        if (!$this->validMac($payload)) {
177 177
             throw new DecryptException('The MAC is invalid.');
178 178
         }
179 179
 
@@ -188,8 +188,8 @@  discard block
 block discarded – undo
188 188
      */
189 189
     protected function validPayload($payload)
190 190
     {
191
-        return is_array($payload) && isset($payload['iv'], $payload['value'], $payload['mac']) &&
192
-            strlen(base64_decode($payload['iv'], true)) === openssl_cipher_iv_length($this->cipher);
191
+        return is_array($payload) && isset($payload[ 'iv' ], $payload[ 'value' ], $payload[ 'mac' ]) &&
192
+            strlen(base64_decode($payload[ 'iv' ], true)) === openssl_cipher_iv_length($this->cipher);
193 193
     }
194 194
 
195 195
     /**
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
         $calculated = $this->calculateMac($payload, $bytes = random_bytes(16));
205 205
 
206 206
         return hash_equals(
207
-            hash_hmac('sha256', $payload['mac'], $bytes, true), $calculated
207
+            hash_hmac('sha256', $payload[ 'mac' ], $bytes, true), $calculated
208 208
         );
209 209
     }
210 210
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
     protected function calculateMac($payload, $bytes)
219 219
     {
220 220
         return hash_hmac(
221
-            'sha256', $this->hash($payload['iv'], $payload['value']), $bytes, true
221
+            'sha256', $this->hash($payload[ 'iv' ], $payload[ 'value' ]), $bytes, true
222 222
         );
223 223
     }
224 224
 
Please login to merge, or discard this patch.
app/framework/Component/EventManager/EventManager.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
             $eventListener = new EventListener();
60 60
         }
61 61
 
62
-        $eventListeners = $this->events->key($eventName, [], true);
63
-        $eventListeners[] = $eventListener;
62
+        $eventListeners = $this->events->key($eventName, [ ], true);
63
+        $eventListeners[ ] = $eventListener;
64 64
         $this->events->key($eventName, $eventListeners);
65 65
 
66 66
         return $eventListener;
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         $eventListeners = $this->events->key($eventName);
105 105
 
106 106
         // to prevent error on empty listeners
107
-        $eventListeners = $eventListeners ?: [];
107
+        $eventListeners = $eventListeners ?: [ ];
108 108
 
109 109
         if (!$this->isInstanceOf($data, '\app\framework\EventManager\Event')) {
110 110
             $data = new Event($data);
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
      */
151 151
     public function getEventListeners($eventName)
152 152
     {
153
-        return $this->events->key($eventName, [], true);
153
+        return $this->events->key($eventName, [ ], true);
154 154
     }
155 155
 
156 156
     /**
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
         // get event prefix
178 178
         $eventPrefix = $this->str($eventName)->subString(0, -1)->val();
179 179
         // Find events starting with the prefix
180
-        $events = [];
180
+        $events = [ ];
181 181
         foreach ($this->events as $eventName => $eventListeners) {
182 182
             if ($this->str($eventName)->startsWith($eventPrefix)) {
183
-                $events[$eventName] = $eventListeners;
183
+                $events[ $eventName ] = $eventListeners;
184 184
             }
185 185
         }
186 186
 
Please login to merge, or discard this patch.
app/framework/Component/EventManager/Event.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
             if (!$this->isArray($eventData) && !$this->isArrayObject($eventData)) {
31 31
                 handle(new EventManagerException(
32 32
                     EventManagerException::MSG_INVALID_ARG,
33
-                    ['$eventData', 'array|ArrayObject'])
33
+                    [ '$eventData', 'array|ArrayObject' ])
34 34
                 );
35 35
             }
36 36
             $this->eventData = $this->arr($eventData);
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
         }
67 67
 
68 68
         if ($this->isNull($name)) {
69
-            $this->eventData[] = $value;
69
+            $this->eventData[ ] = $value;
70 70
         } else {
71
-            $this->eventData[$name] = $value;
71
+            $this->eventData[ $name ] = $value;
72 72
         }
73 73
     }
74 74
 
@@ -229,9 +229,9 @@  discard block
 block discarded – undo
229 229
      */
230 230
     public function toArray()
231 231
     {
232
-        $data = [];
232
+        $data = [ ];
233 233
         foreach ($this->eventData as $k => $v) {
234
-            $data[$k] = $v;
234
+            $data[ $k ] = $v;
235 235
         }
236 236
 
237 237
         return $data;
Please login to merge, or discard this patch.