@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @throws KeyNotFoundException |
22 | 22 | * @throws InvalidArgumentException |
23 | 23 | */ |
24 | - public function createToken($properties = []) |
|
24 | + public function createToken($properties = [ ]) |
|
25 | 25 | { |
26 | 26 | $jwt = Psr11::container()->get('JWT_WRAPPER'); |
27 | 27 | $jwtData = $jwt->createJwtData($properties, 1800); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | try { |
40 | 40 | $jwt = Psr11::container()->get('JWT_WRAPPER'); |
41 | 41 | $tokenInfo = json_decode(json_encode($jwt->extractData($token)), true); |
42 | - return $tokenInfo['data']; |
|
42 | + return $tokenInfo[ 'data' ]; |
|
43 | 43 | } catch (Exception $ex) { |
44 | 44 | throw new Error401Exception($ex->getMessage()); |
45 | 45 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | public function requireRole($role, $token = null) |
56 | 56 | { |
57 | 57 | $data = $this->requireAuthenticated($token); |
58 | - if ($data['role'] !== $role) { |
|
58 | + if ($data[ 'role' ] !== $role) { |
|
59 | 59 | throw new Error401Exception('Insufficient privileges - ' . print_r($data, true)); |
60 | 60 | } |
61 | 61 | return $data; |
@@ -120,14 +120,14 @@ discard block |
||
120 | 120 | |
121 | 121 | $migration = new Migration(new Uri($dbConnection), $this->workdir . "/db"); |
122 | 122 | $migration->registerDatabase("mysql", MySqlDatabase::class); |
123 | - $migration->addCallbackProgress(function ($cmd, $version) { |
|
123 | + $migration->addCallbackProgress(function($cmd, $version) { |
|
124 | 124 | echo "Doing $cmd, $version\n"; |
125 | 125 | }); |
126 | 126 | |
127 | 127 | $argumentList = $this->extractArguments($arguments); |
128 | 128 | |
129 | - $exec['reset'] = function () use ($migration, $argumentList) { |
|
130 | - if (!$argumentList["--yes"]) { |
|
129 | + $exec[ 'reset' ] = function() use ($migration, $argumentList) { |
|
130 | + if (!$argumentList[ "--yes" ]) { |
|
131 | 131 | throw new Exception("Reset require the argument --yes"); |
132 | 132 | } |
133 | 133 | $migration->prepareEnvironment(); |
@@ -135,12 +135,12 @@ discard block |
||
135 | 135 | }; |
136 | 136 | |
137 | 137 | |
138 | - $exec["update"] = function () use ($migration, $argumentList) { |
|
139 | - $migration->update($argumentList["--up-to"], $argumentList["--force"]); |
|
138 | + $exec[ "update" ] = function() use ($migration, $argumentList) { |
|
139 | + $migration->update($argumentList[ "--up-to" ], $argumentList[ "--force" ]); |
|
140 | 140 | }; |
141 | 141 | |
142 | - if (isset($exec[$argumentList['command']])) { |
|
143 | - $exec[$argumentList['command']](); |
|
142 | + if (isset($exec[ $argumentList[ 'command' ] ])) { |
|
143 | + $exec[ $argumentList[ 'command' ] ](); |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
@@ -158,13 +158,13 @@ discard block |
||
158 | 158 | |
159 | 159 | $start = 0; |
160 | 160 | if ($hasCmd) { |
161 | - $ret['command'] = isset($arguments[0]) ? $arguments[0] : null; |
|
161 | + $ret[ 'command' ] = isset($arguments[ 0 ]) ? $arguments[ 0 ] : null; |
|
162 | 162 | $start = 1; |
163 | 163 | } |
164 | 164 | |
165 | - for ($i=$start; $i < count($arguments); $i++) { |
|
166 | - $args = explode("=", $arguments[$i]); |
|
167 | - $ret[$args[0]] = isset($args[1]) ? $args[1] : true; |
|
165 | + for ($i = $start; $i < count($arguments); $i++) { |
|
166 | + $args = explode("=", $arguments[ $i ]); |
|
167 | + $ret[ $args[ 0 ] ] = isset($args[ 1 ]) ? $args[ 1 ] : true; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | return $ret; |
@@ -12,9 +12,9 @@ discard block |
||
12 | 12 | public function execute($workdir, $namespace, $composerName, $phpVersion, $mysqlConnection, $timezone) |
13 | 13 | { |
14 | 14 | $directory = new RecursiveDirectoryIterator($workdir); |
15 | - $filter = new RecursiveCallbackFilterIterator($directory, function ($current/*, $key, $iterator*/) { |
|
15 | + $filter = new RecursiveCallbackFilterIterator($directory, function($current/*, $key, $iterator*/) { |
|
16 | 16 | // Skip hidden files and directories. |
17 | - if ($current->getFilename()[0] === '.') { |
|
17 | + if ($current->getFilename()[ 0 ] === '.') { |
|
18 | 18 | return false; |
19 | 19 | } |
20 | 20 | if ($current->isDir()) { |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | } |
49 | 49 | |
50 | 50 | // Replace MySQL Connection |
51 | - $files = [ 'config/config-dev.php', 'config/config-homolog.php' , 'config/config-live.php', 'config/config-test.php']; |
|
51 | + $files = [ 'config/config-dev.php', 'config/config-homolog.php', 'config/config-live.php', 'config/config-test.php' ]; |
|
52 | 52 | foreach ($files as $file) { |
53 | 53 | $contents = file_get_contents("$workdir/$file"); |
54 | 54 | file_put_contents( |