@@ -37,7 +37,7 @@ |
||
37 | 37 | */ |
38 | 38 | public function register() |
39 | 39 | { |
40 | - set_exception_handler([$this,'uncaughtException']); |
|
40 | + set_exception_handler([$this, 'uncaughtException']); |
|
41 | 41 | return $this; |
42 | 42 | } |
43 | 43 |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | // 添加 * ? 匹配 |
37 | 37 | $url = str_replace(['\*', '\?'], ['[^/]*?', '[^/]'], $url); |
38 | 38 | // 编译页面参数 |
39 | - $url = preg_replace_callback('/\{(\w+)(?:\:([^}]+?))?\}/', function ($match) use (&$parameters) { |
|
39 | + $url = preg_replace_callback('/\{(\w+)(?:\:([^}]+?))?\}/', function($match) use (&$parameters) { |
|
40 | 40 | $name = $match[1]; |
41 | 41 | $type = 'string'; |
42 | 42 | $extra = ''; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $url = static::parseIgnorableParameter($url, $matcher, $parameter, $mapper); |
71 | 71 | $url = static::replaceParameter($url, $matcher, $parameter, $mapper); |
72 | 72 | if (count($query) && $allowQuery) { |
73 | - return $url . '?' . http_build_query($query, 'v', '&', PHP_QUERY_RFC3986); |
|
73 | + return $url.'?'.http_build_query($query, 'v', '&', PHP_QUERY_RFC3986); |
|
74 | 74 | } |
75 | 75 | return $url; |
76 | 76 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | array $parameter, |
89 | 89 | array $mapper |
90 | 90 | ): string { |
91 | - return preg_replace_callback('/\[(.+?)\]/', function ($match) use ($matcher, $parameter, $mapper) { |
|
91 | + return preg_replace_callback('/\[(.+?)\]/', function($match) use ($matcher, $parameter, $mapper) { |
|
92 | 92 | if (preg_match('/\{(\w+).+?\}/', $match[1])) { |
93 | 93 | $count = 0; |
94 | 94 | $subUrl = static::replaceParameter($match[1], $matcher, $parameter, $mapper, true, $count); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | foreach ($parameter as $key => $value) { |
108 | 108 | if (is_numeric($key)) { |
109 | 109 | $mp = $matcher->getParameterByIndex($key); |
110 | - if ($mp !== null) { |
|
110 | + if ($mp !== null) { |
|
111 | 111 | unset($parameter[$key]); |
112 | 112 | $key = $mp->getIndexName(); |
113 | 113 | $parameter[$key] = $value; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | ) { |
144 | 144 | return preg_replace_callback( |
145 | 145 | '/\{(\w+).+?\}/', |
146 | - function ($match) use ($matcher, $parameter, $mapper, $ignore, &$count) { |
|
146 | + function($match) use ($matcher, $parameter, $mapper, $ignore, &$count) { |
|
147 | 147 | if (array_key_exists($match[1], $mapper)) { |
148 | 148 | $count++; |
149 | 149 | return $mapper[$match[1]]->packValue($parameter[$match[1]]); |
@@ -62,12 +62,12 @@ discard block |
||
62 | 62 | $methodStart = $splitLength ?: strpos($command, '::') ?: $dynmicsMethod; |
63 | 63 | $parameter = self::buildParameter($parameter); |
64 | 64 | if ($methodStart > 0) { |
65 | - $splitLength = $splitLength > 0 ? 1:2; |
|
65 | + $splitLength = $splitLength > 0 ? 1 : 2; |
|
66 | 66 | $methodName = substr($command, $methodStart + $splitLength); |
67 | 67 | $command = substr($command, 0, $methodStart); |
68 | 68 | list($className, $constructParameter) = self::splitParameter($command); |
69 | 69 | $constructParameter = self::buildParameter($constructParameter); |
70 | - $target = new MethodTarget($className, $dynmicsMethod? $constructParameter :null, $methodName, $parameter); |
|
70 | + $target = new MethodTarget($className, $dynmicsMethod ? $constructParameter : null, $methodName, $parameter); |
|
71 | 71 | } else { |
72 | 72 | $target = new FunctionTarget(self::buildName($command), $parameter); |
73 | 73 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | if (preg_match('/^[\w\\\\\/.]+$/', $name) !== 1) { |
100 | 100 | throw new InvalidNameException(sprintf('invalid name: %s ', $name)); |
101 | 101 | } |
102 | - return str_replace(['.','/'], '\\', $name); |
|
102 | + return str_replace(['.', '/'], '\\', $name); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | private static function splitParameter(string $command):array |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $parameter = substr($command, $paramStart + 1, strlen($command) - $paramStart - 2); |
111 | 111 | $command = substr($command, 0, $paramStart); |
112 | 112 | } |
113 | - return [$command,$parameter]; |
|
113 | + return [$command, $parameter]; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | private static function buildParameter(?string $parameter) |
@@ -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 | } |