@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @throws \ByJG\Config\Exception\KeyNotFoundException |
| 17 | 17 | * @throws \Psr\SimpleCache\InvalidArgumentException |
| 18 | 18 | */ |
| 19 | - public function createToken($properties = []) |
|
| 19 | + public function createToken($properties = [ ]) |
|
| 20 | 20 | { |
| 21 | 21 | $jwt = Psr11::container()->get('JWT_WRAPPER'); |
| 22 | 22 | $jwtData = $jwt->createJwtData($properties, 1800); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | try { |
| 35 | 35 | $jwt = Psr11::container()->get('JWT_WRAPPER'); |
| 36 | 36 | $tokenInfo = json_decode(json_encode($jwt->extractData($token)), true); |
| 37 | - return $tokenInfo['data']; |
|
| 37 | + return $tokenInfo[ 'data' ]; |
|
| 38 | 38 | } catch (\Exception $ex) { |
| 39 | 39 | throw new Error401Exception($ex->getMessage()); |
| 40 | 40 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | public function requireRole($role, $token = null) |
| 51 | 51 | { |
| 52 | 52 | $data = $this->requireAuthenticated($token); |
| 53 | - if ($data['role'] !== $role) { |
|
| 53 | + if ($data[ 'role' ] !== $role) { |
|
| 54 | 54 | throw new Error401Exception('Insufficient privileges - ' . print_r($data, true)); |
| 55 | 55 | } |
| 56 | 56 | return $data; |
@@ -9,9 +9,9 @@ discard block |
||
| 9 | 9 | public function execute($workdir, $namespace, $composerName, $phpVersion, $mysqlConnection, $timezone) |
| 10 | 10 | { |
| 11 | 11 | $directory = new \RecursiveDirectoryIterator($workdir); |
| 12 | - $filter = new \RecursiveCallbackFilterIterator($directory, function ($current/*, $key, $iterator*/) { |
|
| 12 | + $filter = new \RecursiveCallbackFilterIterator($directory, function($current/*, $key, $iterator*/) { |
|
| 13 | 13 | // Skip hidden files and directories. |
| 14 | - if ($current->getFilename()[0] === '.') { |
|
| 14 | + if ($current->getFilename()[ 0 ] === '.') { |
|
| 15 | 15 | return false; |
| 16 | 16 | } |
| 17 | 17 | if ($current->isDir()) { |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | // Replace MySQL Connection |
| 48 | - $files = [ 'config/config-dev.php', 'config/config-homolog.php' , 'config/config-live.php', 'config/config-test.php']; |
|
| 48 | + $files = [ 'config/config-dev.php', 'config/config-homolog.php', 'config/config-live.php', 'config/config-test.php' ]; |
|
| 49 | 49 | foreach ($files as $file) { |
| 50 | 50 | $contents = file_get_contents("$workdir/$file"); |
| 51 | 51 | file_put_contents( |
@@ -114,14 +114,14 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | $migration = new Migration(new Uri($dbConnection), $this->workdir . "/db"); |
| 116 | 116 | $migration->registerDatabase("mysql", MySqlDatabase::class); |
| 117 | - $migration->addCallbackProgress(function ($cmd, $version) { |
|
| 117 | + $migration->addCallbackProgress(function($cmd, $version) { |
|
| 118 | 118 | echo "Doing $cmd, $version\n"; |
| 119 | 119 | }); |
| 120 | 120 | |
| 121 | 121 | $argumentList = $this->extractArguments($arguments); |
| 122 | 122 | |
| 123 | - $exec['reset'] = function () use ($migration, $argumentList) { |
|
| 124 | - if (!$argumentList["--yes"]) { |
|
| 123 | + $exec[ 'reset' ] = function() use ($migration, $argumentList) { |
|
| 124 | + if (!$argumentList[ "--yes" ]) { |
|
| 125 | 125 | throw new \Exception("Reset require the argument --yes"); |
| 126 | 126 | } |
| 127 | 127 | $migration->prepareEnvironment(); |
@@ -129,12 +129,12 @@ discard block |
||
| 129 | 129 | }; |
| 130 | 130 | |
| 131 | 131 | |
| 132 | - $exec["update"] = function () use ($migration, $argumentList) { |
|
| 133 | - $migration->update($argumentList["--up-to"], $argumentList["--force"]); |
|
| 132 | + $exec[ "update" ] = function() use ($migration, $argumentList) { |
|
| 133 | + $migration->update($argumentList[ "--up-to" ], $argumentList[ "--force" ]); |
|
| 134 | 134 | }; |
| 135 | 135 | |
| 136 | - if (isset($exec[$argumentList['command']])) { |
|
| 137 | - $exec[$argumentList['command']](); |
|
| 136 | + if (isset($exec[ $argumentList[ 'command' ] ])) { |
|
| 137 | + $exec[ $argumentList[ 'command' ] ](); |
|
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | |
@@ -152,13 +152,13 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | $start = 0; |
| 154 | 154 | if ($hasCmd) { |
| 155 | - $ret['command'] = isset($arguments[0]) ? $arguments[0] : null; |
|
| 155 | + $ret[ 'command' ] = isset($arguments[ 0 ]) ? $arguments[ 0 ] : null; |
|
| 156 | 156 | $start = 1; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - for ($i=$start; $i < count($arguments); $i++) { |
|
| 160 | - $args = explode("=", $arguments[$i]); |
|
| 161 | - $ret[$args[0]] = isset($args[1]) ? $args[1] : true; |
|
| 159 | + for ($i = $start; $i < count($arguments); $i++) { |
|
| 160 | + $args = explode("=", $arguments[ $i ]); |
|
| 161 | + $ret[ $args[ 0 ] ] = isset($args[ 1 ]) ? $args[ 1 ] : true; |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | return $ret; |