@@ -17,7 +17,7 @@ |
||
17 | 17 | define('COMMANDS_DIR', APP_DIR.'/commands'); |
18 | 18 | define('VIEWS_DIR', APP_DIR.'/views'); |
19 | 19 | define('LIBS_DIR', APP_DIR.'/libs'); |
20 | - define('TMP_DIR', dirname(APP_DIR) .'/tmp'); |
|
20 | + define('TMP_DIR', dirname(APP_DIR).'/tmp'); |
|
21 | 21 | define('LOGS_DIR', TMP_DIR.'/logs'); |
22 | 22 | |
23 | 23 | // define namespace |
@@ -18,7 +18,7 @@ |
||
18 | 18 | $env = ($env === null) ? '' : '-'.$env; |
19 | 19 | $configfile = CONFIG_DIR.'/config'.$env.'.php'; |
20 | 20 | if (!file_exists($configfile)) { |
21 | - throw new \Exception('Unable to find config file -> ' . $configfile); |
|
21 | + throw new \Exception('Unable to find config file -> '.$configfile); |
|
22 | 22 | } |
23 | 23 | self::$config = require $configfile; |
24 | 24 | $commonConfig = require CONFIG_DIR.'/config-common.php'; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | protected function getHeader($key, $default = null) |
94 | 94 | { |
95 | - $headerName = 'HTTP_' . str_replace('-', '_', strtoupper($key)); |
|
95 | + $headerName = 'HTTP_'.str_replace('-', '_', strtoupper($key)); |
|
96 | 96 | if (!isset($_SERVER[$headerName])) { |
97 | 97 | return $default; |
98 | 98 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * @param int $responseCode |
180 | 180 | * @return void |
181 | 181 | */ |
182 | - protected function respondView($path, $data=[], $responseCode = 200) |
|
182 | + protected function respondView($path, $data = [], $responseCode = 200) |
|
183 | 183 | { |
184 | 184 | http_response_code($responseCode); |
185 | 185 | require(VIEWS_DIR.'/'.$path.'.php'); |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * @param array<mixed> $data |
191 | 191 | * @return string|false |
192 | 192 | */ |
193 | - protected function extractView($path, $data=[]) |
|
193 | + protected function extractView($path, $data = []) |
|
194 | 194 | { |
195 | 195 | ob_start(); |
196 | 196 | $this->respondView($path, $data); |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * @param int $responseCode |
205 | 205 | * @return void |
206 | 206 | */ |
207 | - protected function respondJson($data=[], $responseCode = 200) |
|
207 | + protected function respondJson($data = [], $responseCode = 200) |
|
208 | 208 | { |
209 | 209 | $json = json_encode($data); |
210 | 210 | http_response_code($responseCode); |
@@ -83,7 +83,7 @@ |
||
83 | 83 | curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); |
84 | 84 | curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); |
85 | 85 | if ($method === 'GET') { |
86 | - curl_setopt($curl, CURLOPT_URL, $url . (strpos($url, '?') === false ? '?' : '&') . http_build_query($params)); |
|
86 | + curl_setopt($curl, CURLOPT_URL, $url.(strpos($url, '?') === false ? '?' : '&').http_build_query($params)); |
|
87 | 87 | } elseif ($method === 'POST' || $method === 'PUT' || $method === 'PATCH' || $method === 'DELETE') { |
88 | 88 | curl_setopt($curl, CURLOPT_URL, $url); |
89 | 89 | if (count(preg_grep("/^Content-Type: application\/json/i", $headers)) > 0) { |
@@ -109,7 +109,7 @@ |
||
109 | 109 | |
110 | 110 | $command = COMMANDS_NS.'\\'.str_replace('/', '\\', $argv[1]); |
111 | 111 | if (!class_exists($command)) { |
112 | - throw new \Exception('Unable to load command class ->' . $command); |
|
112 | + throw new \Exception('Unable to load command class ->'.$command); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | $class = new $command(); |
@@ -33,7 +33,7 @@ |
||
33 | 33 | * @param string $dbconfig |
34 | 34 | * @return self |
35 | 35 | */ |
36 | - public static function connection($dbconfig='database') |
|
36 | + public static function connection($dbconfig = 'database') |
|
37 | 37 | { |
38 | 38 | static $instances = []; |
39 | 39 | if (empty($instances[$dbconfig])) { |