@@ -47,7 +47,7 @@ |
||
47 | 47 | public function status(int $statusCode) |
48 | 48 | { |
49 | 49 | $this->response->status($statusCode); |
50 | - $this->status = $statusCode; |
|
50 | + $this->status = $statusCode; |
|
51 | 51 | return $this; |
52 | 52 | } |
53 | 53 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | { |
38 | 38 | $absolute = PathTrait::toAbsolutePath($target); |
39 | 39 | $root = PathTrait::toAbsolutePath($root); |
40 | - return strpos($absolute, $root . DIRECTORY_SEPARATOR) !== 0; |
|
40 | + return strpos($absolute, $root.DIRECTORY_SEPARATOR) !== 0; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | |
101 | 101 | protected static function tryWriteDirectory(string $path): bool |
102 | 102 | { |
103 | - $path = rtrim($path, '/') . '/' . md5(mt_rand(1, 100) . mt_rand(1, 100)); |
|
103 | + $path = rtrim($path, '/').'/'.md5(mt_rand(1, 100).mt_rand(1, 100)); |
|
104 | 104 | if (($fp = fopen($path, 'ab')) === false) { |
105 | 105 | return false; |
106 | 106 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $replace['%level%'] = $level; |
58 | 58 | $replace['%message%'] = $message; |
59 | 59 | $write = strtr($this->getConfig('log-format'), $replace); |
60 | - fwrite($this->getAvailableWrite(), $write . PHP_EOL); |
|
60 | + fwrite($this->getAvailableWrite(), $write.PHP_EOL); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | } elseif (null === $val) { |
100 | 100 | $val = 'null'; |
101 | 101 | } |
102 | - $replace['{' . $key . '}'] = $val; |
|
102 | + $replace['{'.$key.'}'] = $val; |
|
103 | 103 | } |
104 | 104 | return strtr($message, $replace); |
105 | 105 | } |
@@ -109,14 +109,14 @@ discard block |
||
109 | 109 | { |
110 | 110 | $unique = substr(md5(uniqid()), 0, 8); |
111 | 111 | $save = $this->getConfig('save-path'); |
112 | - $this->tempName = $save . '/' . date('YmdHis') . '.' . $unique . '.log'; |
|
112 | + $this->tempName = $save.'/'.date('YmdHis').'.'.$unique.'.log'; |
|
113 | 113 | $temp = fopen($this->tempName, 'w+'); |
114 | 114 | if ($temp !== false) { |
115 | 115 | $this->temp = $temp; |
116 | 116 | } else { |
117 | - throw new FileLoggerException(__METHOD__ . ':' . sprintf('cannot create log file')); |
|
117 | + throw new FileLoggerException(__METHOD__.':'.sprintf('cannot create log file')); |
|
118 | 118 | } |
119 | - $this->latest = $save . '/' . $this->getConfig('file-name'); |
|
119 | + $this->latest = $save.'/'.$this->getConfig('file-name'); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -143,14 +143,14 @@ discard block |
||
143 | 143 | */ |
144 | 144 | protected function zipFile(ZipArchive $zip, string $logFile) |
145 | 145 | { |
146 | - $add = $zip->addFile($logFile, date('Y-m-d') . '-' . $zip->numFiles . '.log'); |
|
146 | + $add = $zip->addFile($logFile, date('Y-m-d').'-'.$zip->numFiles.'.log'); |
|
147 | 147 | if (is_dir($this->getConfig('save-dump-path'))) { |
148 | 148 | $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator( |
149 | 149 | $this->getConfig('save-dump-path'), |
150 | 150 | RecursiveDirectoryIterator::SKIP_DOTS |
151 | 151 | )); |
152 | 152 | foreach ($it as $dumpLog) { |
153 | - if ($zip->addFile($dumpLog, 'dump/' . basename($dumpLog))) { |
|
153 | + if ($zip->addFile($dumpLog, 'dump/'.basename($dumpLog))) { |
|
154 | 154 | array_push($this->removeFiles, $dumpLog); |
155 | 155 | } |
156 | 156 | } |
@@ -170,8 +170,8 @@ discard block |
||
170 | 170 | $this->safeMoveKeep( |
171 | 171 | $logFile, |
172 | 172 | $this->getConfig('save-path') |
173 | - . '/' . date('Y-m-d') |
|
174 | - . '-' . substr(md5(uniqid()), 0, 8) . '.log' |
|
173 | + . '/'.date('Y-m-d') |
|
174 | + . '-'.substr(md5(uniqid()), 0, 8).'.log' |
|
175 | 175 | ); |
176 | 176 | } |
177 | 177 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $path = preg_replace( |
201 | 201 | '/[\\\\]+/', |
202 | 202 | '/', |
203 | - $this->getConfig('save-zip-path') . '/' . date('Y-m-d') . '.zip' |
|
203 | + $this->getConfig('save-zip-path').'/'.date('Y-m-d').'.zip' |
|
204 | 204 | ); |
205 | 205 | $zip = $this->getZipArchive($path); |
206 | 206 | if ($zip !== null) { |
@@ -110,7 +110,7 @@ |
||
110 | 110 | public function get(string $name = null, $default = null) |
111 | 111 | { |
112 | 112 | if ($name !== null) { |
113 | - return $this->has($name) ?$_SESSION[$name]:$default; |
|
113 | + return $this->has($name) ? $_SESSION[$name] : $default; |
|
114 | 114 | } else { |
115 | 115 | return $_SESSION; |
116 | 116 | } |
@@ -8,7 +8,7 @@ |
||
8 | 8 | */ |
9 | 9 | interface DumpInterface |
10 | 10 | { |
11 | - public static function parameterToString($object, int $deep=2); |
|
11 | + public static function parameterToString($object, int $deep = 2); |
|
12 | 12 | public static function dumpThrowable(Throwable $e); |
13 | - public static function dumpTrace(array $backtrace, bool $str=true, string $perfix=''); |
|
13 | + public static function dumpTrace(array $backtrace, bool $str = true, string $perfix = ''); |
|
14 | 14 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | { |
58 | 58 | if (array_key_exists($name, $this->processor)) { |
59 | 59 | if ($this->processor[$name] === ObjectMiddleware::SERIALIZE) { |
60 | - return $data === null? $data : serialize($data); |
|
60 | + return $data === null ? $data : serialize($data); |
|
61 | 61 | } |
62 | 62 | if ($this->processor[$name] === ObjectMiddleware::JSON) { |
63 | 63 | return json_encode($data); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | if ($doc = $property->getDocComment()) { |
114 | 114 | if (is_string($doc) && preg_match('/@var\s+(\w+)/i', $doc, $match)) { |
115 | 115 | $type = strtolower($match[1]); |
116 | - if (in_array($type, ['boolean', 'bool', 'integer', 'int' , 'float' , 'double', 'string'])) { |
|
116 | + if (in_array($type, ['boolean', 'bool', 'integer', 'int', 'float', 'double', 'string'])) { |
|
117 | 117 | return ObjectMiddleware::RAW; |
118 | 118 | } |
119 | 119 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | { |
25 | 25 | $this->loadVendorIfExist(); |
26 | 26 | $this->loadShareLibrary(); |
27 | - $this->application->debug()->debug('loaded - ' . $this->module->getFullName()); |
|
27 | + $this->application->debug()->debug('loaded - '.$this->module->getFullName()); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | public function toActive() |
36 | 36 | { |
37 | 37 | $this->loadConfig(); |
38 | - $this->application->debug()->debug('active = ' . $this->module->getFullName()); |
|
38 | + $this->application->debug()->debug('active = '.$this->module->getFullName()); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public function toReachable() |
46 | 46 | { |
47 | 47 | $this->loadRoute(); |
48 | - $this->application->debug()->debug('reachable # ' . $this->module->getFullName()); |
|
48 | + $this->application->debug()->debug('reachable # '.$this->module->getFullName()); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $this->checkRequirements(); |
57 | 57 | $this->loadPrivateLibrary(); |
58 | 58 | $this->application->setRunning($this->module); |
59 | - $this->application->debug()->debug('run + ' . $this->module->getFullName()); |
|
59 | + $this->application->debug()->debug('run + '.$this->module->getFullName()); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function loadVendorIfExist() |
105 | 105 | { |
106 | - $vendorAutoload = $this->module->getPath() . '/vendor/autoload.php'; |
|
106 | + $vendorAutoload = $this->module->getPath().'/vendor/autoload.php'; |
|
107 | 107 | if (FileSystem::exist($vendorAutoload)) { |
108 | 108 | Loader::requireOnce($vendorAutoload); |
109 | 109 | } |
@@ -175,8 +175,8 @@ discard block |
||
175 | 175 | */ |
176 | 176 | protected function loadRouteGroup(string $groupName) |
177 | 177 | { |
178 | - $group = $groupName === 'default' ? '' : '-' . $groupName; |
|
179 | - if ($path = $this->module->getResource()->getConfigResourcePath('config/route' . $group)) { |
|
178 | + $group = $groupName === 'default' ? '' : '-'.$groupName; |
|
179 | + if ($path = $this->module->getResource()->getConfigResourcePath('config/route'.$group)) { |
|
180 | 180 | $routeConfig = Config::loadConfig($path, [ |
181 | 181 | 'module' => $this->module->getName(), |
182 | 182 | 'group' => $groupName, |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | 'config' => $this->module->getConfig(), |
185 | 185 | ]); |
186 | 186 | if ($routeConfig !== null) { |
187 | - $prefix = $this->module->getConfig('route-prefix.' . $groupName, ''); |
|
187 | + $prefix = $this->module->getConfig('route-prefix.'.$groupName, ''); |
|
188 | 188 | $this->loadRouteConfig($prefix, $groupName, $routeConfig); |
189 | 189 | } |
190 | 190 | } |
@@ -212,9 +212,9 @@ discard block |
||
212 | 212 | $uri = $config['uri'] ?? '/'; |
213 | 213 | $anti = array_key_exists('anti-prefix', $config) && $config['anti-prefix']; |
214 | 214 | if ($anti) { |
215 | - $uri = '/' . trim($uri, '/'); |
|
215 | + $uri = '/'.trim($uri, '/'); |
|
216 | 216 | } else { |
217 | - $uri = '/' . trim($prefix . $uri, '/'); |
|
217 | + $uri = '/'.trim($prefix.$uri, '/'); |
|
218 | 218 | } |
219 | 219 | $this->application->request($method, $exname, $uri, $attributes); |
220 | 220 | } |
@@ -72,7 +72,7 @@ |
||
72 | 72 | */ |
73 | 73 | public static function getDataSourceFrom(ApplicationResource $resource, string $groupName) |
74 | 74 | { |
75 | - $group = $groupName === 'default' ? '': '-'. $groupName; |
|
75 | + $group = $groupName === 'default' ? '' : '-'.$groupName; |
|
76 | 76 | $dataSourceConfigPath = $resource->getConfigResourcePath('config/data-source'.$group); |
77 | 77 | $dataSource = new DataSource; |
78 | 78 | if ($dataSourceConfigPath !== null) { |