@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | throw new FileLoggerException(__CLASS__.':'.sprintf('cannot create log file')); |
95 | 95 | } |
96 | 96 | $this->latest = $save.'/'.$this->getConfig('file-name'); |
97 | - register_shutdown_function([$this,'save']); |
|
97 | + register_shutdown_function([$this, 'save']); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | public function getDefaultConfig():array |
@@ -113,10 +113,10 @@ discard block |
||
113 | 113 | protected function packLogFile() |
114 | 114 | { |
115 | 115 | $logFile = $this->latest; |
116 | - $path = preg_replace('/[\\\\]+/', '/', $this->getConfig('save-zip-path') .'/'.date('Y-m-d').'.zip'); |
|
116 | + $path = preg_replace('/[\\\\]+/', '/', $this->getConfig('save-zip-path').'/'.date('Y-m-d').'.zip'); |
|
117 | 117 | $zip = $this->getZipArchive($path); |
118 | 118 | if ($zip !== null) { |
119 | - if ($zip->addFile($logFile, date('Y-m-d'). '-'. $zip->numFiles .'.log')) { |
|
119 | + if ($zip->addFile($logFile, date('Y-m-d').'-'.$zip->numFiles.'.log')) { |
|
120 | 120 | array_push($this->removeFiles, $logFile); |
121 | 121 | } |
122 | 122 | if (is_dir($this->getConfig('save-pack-path'))) { |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $zip->close(); |
131 | 131 | } else { |
132 | 132 | if (is_file($logFile) && file_exists($logFile)) { |
133 | - rename($logFile, $this->getConfig('save-path') . '/' . date('Y-m-d'). '-'. substr(md5_file($logFile), 0, 8).'.log'); |
|
133 | + rename($logFile, $this->getConfig('save-path').'/'.date('Y-m-d').'-'.substr(md5_file($logFile), 0, 8).'.log'); |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | } |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | } elseif (null === $val) { |
236 | 236 | $val = 'null'; |
237 | 237 | } |
238 | - $replace['{' . $key . '}'] = $val; |
|
238 | + $replace['{'.$key.'}'] = $val; |
|
239 | 239 | } |
240 | 240 | return strtr($message, $replace); |
241 | 241 | } |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | public function input(string $name, $data) |
58 | 58 | { |
59 | 59 | if (array_key_exists($name, $this->processor)) { |
60 | - if ($this->processor[$name] === ObjectMiddleware::SERIALIZE){ |
|
61 | - return $data === null? $data : serialize($data); |
|
60 | + if ($this->processor[$name] === ObjectMiddleware::SERIALIZE) { |
|
61 | + return $data === null ? $data : serialize($data); |
|
62 | 62 | } |
63 | - if ($this->processor[$name] === ObjectMiddleware::JSON){ |
|
63 | + if ($this->processor[$name] === ObjectMiddleware::JSON) { |
|
64 | 64 | return json_encode($data); |
65 | 65 | } |
66 | 66 | } |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | public function output(string $name, $data) |
78 | 78 | { |
79 | 79 | if (array_key_exists($name, $this->processor)) { |
80 | - if ($this->processor[$name] === ObjectMiddleware::SERIALIZE){ |
|
80 | + if ($this->processor[$name] === ObjectMiddleware::SERIALIZE) { |
|
81 | 81 | return unserialize($data) ?: null; |
82 | 82 | } |
83 | - if ($this->processor[$name] === ObjectMiddleware::JSON){ |
|
83 | + if ($this->processor[$name] === ObjectMiddleware::JSON) { |
|
84 | 84 | return json_decode($data); |
85 | 85 | } |
86 | 86 | } |
@@ -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 | } |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | */ |
196 | 196 | private function inputSerialize($data) |
197 | 197 | { |
198 | - return $data === null? $data : serialize($data); |
|
198 | + return $data === null ? $data : serialize($data); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | /** |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | */ |
218 | 218 | private function inputJson($data) |
219 | 219 | { |
220 | - return $data === null? $data : json_encode($data); |
|
220 | + return $data === null ? $data : json_encode($data); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
@@ -132,7 +132,7 @@ |
||
132 | 132 | */ |
133 | 133 | public function charset(string $charset) |
134 | 134 | { |
135 | - $this->charset = 'CHARACTER SET ' . $charset; |
|
135 | + $this->charset = 'CHARACTER SET '.$charset; |
|
136 | 136 | return $this; |
137 | 137 | } |
138 | 138 |
@@ -139,7 +139,7 @@ |
||
139 | 139 | if (is_string($doc) && preg_match('/@field\s+(\w+)(?:\((.+?)\))?\s+(.+)?$/im', $doc, $match)) { |
140 | 140 | $type = strtoupper($match[1]); |
141 | 141 | $length = static::parseLength($match[2] ?? ''); |
142 | - return [$type, $length , trim($match[3] ?? '')]; |
|
142 | + return [$type, $length, trim($match[3] ?? '')]; |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | return ['text', null, '']; |
@@ -60,7 +60,7 @@ |
||
60 | 60 | protected function prepareProcessorSet(string $object) |
61 | 61 | { |
62 | 62 | $reflectObject = new ReflectionClass($object); |
63 | - $classDoc = is_string($reflectObject->getDocComment())?$reflectObject->getDocComment():''; |
|
63 | + $classDoc = is_string($reflectObject->getDocComment()) ? $reflectObject->getDocComment() : ''; |
|
64 | 64 | $field = TableClassStructBuilder::readClassDocField($classDoc); |
65 | 65 | if ($field !== null) { |
66 | 66 | $this->createProccorFromStruct(); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function parse(string $modifier) |
51 | 51 | { |
52 | - $this->tokens = token_get_all('<?php '. $modifier); |
|
52 | + $this->tokens = token_get_all('<?php '.$modifier); |
|
53 | 53 | $this->length = count($this->tokens); |
54 | 54 | $this->pos = 1; |
55 | 55 | $this->modifier = []; |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | protected function skipWhiteComment() |
111 | 111 | { |
112 | - for ($i = $this->pos + 1; $i < $this->length ; $i++) { |
|
112 | + for ($i = $this->pos + 1; $i < $this->length; $i++) { |
|
113 | 113 | if (is_array($this->tokens[$i])) { |
114 | 114 | if (in_array($this->tokens[$i][0], [T_COMMENT, T_DOC_COMMENT, T_WHITESPACE])) { |
115 | 115 | $this->pos++; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | public function __construct(string $object) |
41 | 41 | { |
42 | 42 | parent::__construct($object); |
43 | - $this->classDoc = is_string($this->reflectObject->getDocComment())?$this->reflectObject->getDocComment():''; |
|
43 | + $this->classDoc = is_string($this->reflectObject->getDocComment()) ? $this->reflectObject->getDocComment() : ''; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | * @param string $classDoc |
64 | 64 | * @return array|null |
65 | 65 | */ |
66 | - public static function readClassDocField(string $classDoc):?array |
|
66 | + public static function readClassDocField(string $classDoc): ?array |
|
67 | 67 | { |
68 | 68 | if (preg_match_all( |
69 | 69 | '/^.+\s+\@field(?:\-(?:serialize|json))?\s+(\w+)\s+(\w+)(?:\((.+?)\))?(.*?)$/im', |
70 | 70 | $classDoc, |
71 | 71 | $match |
72 | 72 | ) > 0) { |
73 | - return is_array($match)?$match:null; |
|
73 | + return is_array($match) ? $match : null; |
|
74 | 74 | } |
75 | 75 | return null; |
76 | 76 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | */ |
50 | 50 | public static function index(string $name): string |
51 | 51 | { |
52 | - return '_' . $name . '_' . static::$index; |
|
52 | + return '_'.$name.'_'.static::$index; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |