@@ -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 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | { |
41 | 41 | $path = $source; |
42 | 42 | if (Path::isRelativePath($source)) { |
43 | - $path = $relative . '/' . $path; |
|
43 | + $path = $relative.'/'.$path; |
|
44 | 44 | } |
45 | 45 | return Path::toAbsolutePath($path); |
46 | 46 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | foreach ($this->resource as $root) { |
97 | 97 | if ($pathInfo = $this->getTarget($root, $path)) { |
98 | 98 | list($root, $target) = $pathInfo; |
99 | - $templateLimitPath = $limitPath ? $root . '/' . $limitPath : $root; |
|
99 | + $templateLimitPath = $limitPath ? $root.'/'.$limitPath : $root; |
|
100 | 100 | if (FileSystem::exist($target) |
101 | 101 | && FileSystem::isOverflowPath($templateLimitPath, $target) === false) { |
102 | 102 | return $target; |
@@ -115,11 +115,11 @@ discard block |
||
115 | 115 | private function getTarget($root, string $path) |
116 | 116 | { |
117 | 117 | if (is_string($root)) { |
118 | - return [$root, $root . '/' . $path]; |
|
118 | + return [$root, $root.'/'.$path]; |
|
119 | 119 | } |
120 | 120 | list($prefix, $root) = $root; |
121 | 121 | if (strpos($path, $prefix) === 0) { |
122 | - return [$root, $root . '/' . ltrim(substr($path, strlen($prefix)), '/')]; |
|
122 | + return [$root, $root.'/'.ltrim(substr($path, strlen($prefix)), '/')]; |
|
123 | 123 | } |
124 | 124 | return null; |
125 | 125 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | protected function parseStatic($content) |
29 | 29 | { |
30 | - $content = strlen(trim($content)) === 0 ?'()':$content; |
|
30 | + $content = strlen(trim($content)) === 0 ? '()' : $content; |
|
31 | 31 | return '<?php echo $this->getStaticModulePrefix'.$content.'; ?>'; |
32 | 32 | } |
33 | 33 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | protected function parseE($content) |
39 | 39 | { |
40 | - $content = strlen(trim($content)) === 0 ?'()':$content; |
|
40 | + $content = strlen(trim($content)) === 0 ? '()' : $content; |
|
41 | 41 | return '<?php echo $this->application->_'.$content.'; ?>'; |
42 | 42 | } |
43 | 43 | } |
@@ -26,14 +26,14 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @var Tag[] |
28 | 28 | */ |
29 | - protected $tags=[]; |
|
29 | + protected $tags = []; |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * 命令对象 |
33 | 33 | * |
34 | 34 | * @var CommandInterface[] |
35 | 35 | */ |
36 | - protected $commands=[]; |
|
36 | + protected $commands = []; |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * 初始化 |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function registerTag(Tag $tag) |
83 | 83 | { |
84 | - $this->tags[$tag->getName()] =$tag; |
|
84 | + $this->tags[$tag->getName()] = $tag; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -95,15 +95,15 @@ discard block |
||
95 | 95 | public function compileText(string $text, array $tagConfig = []):string |
96 | 96 | { |
97 | 97 | $this->applyTagConfig($tagConfig); |
98 | - $result = ''; |
|
98 | + $result = ''; |
|
99 | 99 | foreach (token_get_all($text) as $token) { |
100 | 100 | if (is_array($token)) { |
101 | 101 | list($tag, $content) = $token; |
102 | 102 | // 所有将要编译的文本 |
103 | 103 | // 跳过各种的PHP |
104 | 104 | if ($tag == T_INLINE_HTML) { |
105 | - $content=$this->processTags($content); |
|
106 | - $content=$this->processCommands($content); |
|
105 | + $content = $this->processTags($content); |
|
106 | + $content = $this->processCommands($content); |
|
107 | 107 | } |
108 | 108 | $result .= $content; |
109 | 109 | } else { |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | { |
140 | 140 | foreach ($this->tags as $tag) { |
141 | 141 | $pregExp = sprintf('/(!)?%s\s*(.+?)\s*%s/', preg_quote($tag->getOpen()), preg_quote($tag->getClose())); |
142 | - $text = preg_replace_callback($pregExp, function ($match) use ($tag) { |
|
142 | + $text = preg_replace_callback($pregExp, function($match) use ($tag) { |
|
143 | 143 | if ($match[1] === '!') { |
144 | 144 | return substr($match[0], 1); |
145 | 145 | } else { |
@@ -157,8 +157,8 @@ discard block |
||
157 | 157 | */ |
158 | 158 | protected function processCommands(string $text):string |
159 | 159 | { |
160 | - $pregExp ='/\B\@(\!)?([\w\x{4e00}-\x{9aff}]+)(\s*)(\( ( (?>[^()]+) | (?4) )* \) )? /ux'; |
|
161 | - $code = preg_replace_callback($pregExp, [$this,'doMatchCommand'], $text); |
|
160 | + $pregExp = '/\B\@(\!)?([\w\x{4e00}-\x{9aff}]+)(\s*)(\( ( (?>[^()]+) | (?4) )* \) )? /ux'; |
|
161 | + $code = preg_replace_callback($pregExp, [$this, 'doMatchCommand'], $text); |
|
162 | 162 | $error = preg_last_error(); |
163 | 163 | if ($error !== PREG_NO_ERROR) { |
164 | 164 | throw new Exception($error); |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | list($input, $ignore, $name, $space) = $match; |
175 | 175 | $params = ''; |
176 | 176 | } |
177 | - if ($ignore ==='!') { |
|
177 | + if ($ignore === '!') { |
|
178 | 178 | return str_replace('@!', '@', $input); |
179 | 179 | } else { |
180 | 180 | foreach ($this->commands as $command) { |
@@ -31,7 +31,7 @@ |
||
31 | 31 | */ |
32 | 32 | public function packValue(?string $matched) |
33 | 33 | { |
34 | - return $matched ? urlencode($matched): ''; |
|
34 | + return $matched ? urlencode($matched) : ''; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | { |
44 | 44 | $this->routes = new RouteCollection; |
45 | 45 | $this->runnable = []; |
46 | - $this->default = new Runnable([__CLASS__ , 'defaultResponse']); |
|
46 | + $this->default = new Runnable([__CLASS__, 'defaultResponse']); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * @param bool $allowQuery |
301 | 301 | * @return string|null |
302 | 302 | */ |
303 | - public function create(string $name, array $parameter, bool $allowQuery = true):?string |
|
303 | + public function create(string $name, array $parameter, bool $allowQuery = true): ?string |
|
304 | 304 | { |
305 | 305 | if ($matcher = $this->routes->get($name)) { |
306 | 306 | return UriMatcher::buildUri($matcher->getMatcher(), $parameter, $allowQuery); |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $subfix = $this->config['subfix'] ?? '.tpl.html'; |
22 | 22 | $path = $this |
23 | 23 | ->getResource($this->module) |
24 | - ->getResourcePath($this->getTemplatePath() . '/' . $this->name . $subfix); |
|
24 | + ->getResourcePath($this->getTemplatePath().'/'.$this->name.$subfix); |
|
25 | 25 | $this->loadDynamicTemplateConfig($path.'.ini'); |
26 | 26 | return $path; |
27 | 27 | } |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function getPath() |
48 | 48 | { |
49 | - $output = $this->config['output'] ?? $this->application->getDataPath() . '/template/' . $this->uriName; |
|
49 | + $output = $this->config['output'] ?? $this->application->getDataPath().'/template/'.$this->uriName; |
|
50 | 50 | FileSystem::make($output); |
51 | - return $output . '/' . $this->name . '.php'; |
|
51 | + return $output.'/'.$this->name.'.php'; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function getRenderedString() |
74 | 74 | { |
75 | - $this->application->debug()->time('render ' . $this->name); |
|
75 | + $this->application->debug()->time('render '.$this->name); |
|
76 | 76 | $code = parent::getRenderedString(); |
77 | - $time = $this->application->debug()->timeEnd('render ' . $this->name); |
|
77 | + $time = $this->application->debug()->timeEnd('render '.$this->name); |
|
78 | 78 | $this->application->debug()->recordTiming('render', $time); |
79 | 79 | return $code; |
80 | 80 | } |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | protected function compile() |
87 | 87 | { |
88 | 88 | if ($this->isCompiled() === false) { |
89 | - $this->application->debug()->time('compile ' . $this->name); |
|
89 | + $this->application->debug()->time('compile '.$this->name); |
|
90 | 90 | $result = parent::compile(); |
91 | - $this->application->debug()->timeEnd('compile ' . $this->name); |
|
91 | + $this->application->debug()->timeEnd('compile '.$this->name); |
|
92 | 92 | return $result; |
93 | 93 | } |
94 | 94 | return true; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | } |
113 | 113 | return $this->application->getUrl($this->request, $name, $values ?? [], true, $this->module, $this->group); |
114 | 114 | } elseif (is_string($defaultName)) { |
115 | - $parameter = is_array($name)?array_merge($query, $name):$query; |
|
115 | + $parameter = is_array($name) ?array_merge($query, $name) : $query; |
|
116 | 116 | return $this->application->getUrl( |
117 | 117 | $this->request, |
118 | 118 | $defaultName, |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $this->group |
123 | 123 | ); |
124 | 124 | } |
125 | - return '#' . $defaultName; |
|
125 | + return '#'.$defaultName; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 |
@@ -47,7 +47,7 @@ |
||
47 | 47 | { |
48 | 48 | $this->count++; |
49 | 49 | $query = $connection->prefix($statement->getString()); |
50 | - $this->debug->recordTiming('query', $timeSpend, $this->count . ' queries'); |
|
50 | + $this->debug->recordTiming('query', $timeSpend, $this->count.' queries'); |
|
51 | 51 | $status = $result ? 'OK' : 'Err'; |
52 | 52 | if ($result) { |
53 | 53 | $effect = $statement->getStatement()->rowCount(); |