@@ -75,9 +75,9 @@ |
||
| 75 | 75 | |
| 76 | 76 | public static function getConfig($dir, $Label) |
| 77 | 77 | { |
| 78 | - $Config = $dir . '/config/' . $Label . '.php'; |
|
| 78 | + $Config = $dir.'/config/'.$Label.'.php'; |
|
| 79 | 79 | if (!file_exists($Config)) { |
| 80 | - throw new \Exception($Config . ' not found in '.static::class.'::config()'); |
|
| 80 | + throw new \Exception($Config.' not found in '.static::class.'::config()'); |
|
| 81 | 81 | } |
| 82 | 82 | return require $Config; |
| 83 | 83 | } |
@@ -97,9 +97,9 @@ discard block |
||
| 97 | 97 | public static function connectionTester($config) |
| 98 | 98 | { |
| 99 | 99 | if ($config['socket']) { |
| 100 | - $DSN = 'mysql:unix_socket=' . $config['socket'] . ';dbname=' . $config['database']; |
|
| 100 | + $DSN = 'mysql:unix_socket='.$config['socket'].';dbname='.$config['database']; |
|
| 101 | 101 | } else { |
| 102 | - $DSN = 'mysql:host=' . $config['host'] . ';port=' . $config['port'] .';dbname=' . $config['database']; |
|
| 102 | + $DSN = 'mysql:host='.$config['host'].';port='.$config['port'].';dbname='.$config['database']; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | try { |
@@ -115,10 +115,10 @@ discard block |
||
| 115 | 115 | * Uses ascii table chars decimal 33 (!) -> 126 (~) |
| 116 | 116 | * covers basic symbols and letters |
| 117 | 117 | */ |
| 118 | - public static function createPassword($length=20) |
|
| 118 | + public static function createPassword($length = 20) |
|
| 119 | 119 | { |
| 120 | 120 | $password = ''; |
| 121 | - while (strlen($password)<$length) { |
|
| 121 | + while (strlen($password) < $length) { |
|
| 122 | 122 | $password .= chr(mt_rand(33, 126)); |
| 123 | 123 | } |
| 124 | 124 | return $password; |
@@ -176,7 +176,7 @@ |
||
| 176 | 176 | $defaults = require getcwd().'/vendor/divergence/divergence/config/db.php'; |
| 177 | 177 | foreach ($config as $label=>$dbconf) { |
| 178 | 178 | if ($dbconf === $defaults[$label]) { |
| 179 | - if (in_array($label, ['mysql','dev-mysql'])) { |
|
| 179 | + if (in_array($label, ['mysql', 'dev-mysql'])) { |
|
| 180 | 180 | $climate->info(sprintf('Detected default database config %s', $label)); |
| 181 | 181 | $input = $climate->confirm('Build database config <bold><yellow>'.$label.'</yellow></bold>?'); |
| 182 | 182 | $input->defaultTo('y'); |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | continue; |
| 130 | 130 | } |
| 131 | 131 | // find config label |
| 132 | - if ($depth === 1 && $token[0]==323) { // T_CONSTANT_ENCAPSED_STRING |
|
| 132 | + if ($depth === 1 && $token[0] == 323) { // T_CONSTANT_ENCAPSED_STRING |
|
| 133 | 133 | $strValue = substr($token[1], 1, -1); |
| 134 | 134 | if ($strValue == $label) { |
| 135 | 135 | $labelLine = $token[2]; // remember line # where the config we care about starts |
@@ -139,13 +139,13 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | // find key value pair |
| 141 | 141 | if ($labelLine) { |
| 142 | - if ($depth === 2 && $token[0]==323) { |
|
| 142 | + if ($depth === 2 && $token[0] == 323) { |
|
| 143 | 143 | if ($nextKey) { |
| 144 | 144 | $nextKey = false; |
| 145 | 145 | // found key for setting |
| 146 | 146 | $strValue = substr($token[1], 1, -1); |
| 147 | 147 | if ($strValue === $setting) { |
| 148 | - $returnTokens['key'] = ['token'=>$token,'index'=>$key]; |
|
| 148 | + $returnTokens['key'] = ['token'=>$token, 'index'=>$key]; |
|
| 149 | 149 | //$climate->out(sprintf('Found key <yellow>%s</yellow> at line <green>%s</green>',$token[1],$token[2])); // make verbose mode |
| 150 | 150 | continue; |
| 151 | 151 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | if ($returnTokens['key']) { |
| 155 | 155 | $strValue = substr($token[1], 1, -1); |
| 156 | 156 | //$climate->out(sprintf('Found value <yellow>%s</yellow> at line <green>%s</green>',$token[1],$token[2])); // make verbose mode |
| 157 | - $returnTokens['value'] = ['token'=>$token,'index'=>$key]; |
|
| 157 | + $returnTokens['value'] = ['token'=>$token, 'index'=>$key]; |
|
| 158 | 158 | return $returnTokens; |
| 159 | 159 | } |
| 160 | 160 | $nextKey = true; |