@@ -9,7 +9,7 @@ |
||
9 | 9 | * HTTP请求解析器 |
10 | 10 | * |
11 | 11 | */ |
12 | -class Request { |
|
12 | +class Request { |
|
13 | 13 | |
14 | 14 | use URIAttribute; |
15 | 15 |
@@ -149,26 +149,26 @@ |
||
149 | 149 | { |
150 | 150 | $url = $this->uri; |
151 | 151 | |
152 | - $queryString=''; |
|
152 | + $queryString = ''; |
|
153 | 153 | // for /?/xx |
154 | 154 | if (\strpos($url, '/?/') === 0) { |
155 | 155 | $url = substr($url, 2); |
156 | 156 | } |
157 | 157 | $indexFile = $this->getIndexFile(); |
158 | - if (\strpos($url, $indexFile) ===0) { |
|
158 | + if (\strpos($url, $indexFile) === 0) { |
|
159 | 159 | // for /index.php/ |
160 | - $url = \substr($url, strlen($indexFile));// for /index.php?/ |
|
160 | + $url = \substr($url, strlen($indexFile)); // for /index.php?/ |
|
161 | 161 | if (\strpos($url, '?/') === 0) { |
162 | 162 | $url = ltrim($url, '?'); |
163 | 163 | } |
164 | 164 | // for /index.php |
165 | - elseif (\strpos($url, '/')!== 0) { |
|
165 | + elseif (\strpos($url, '/') !== 0) { |
|
166 | 166 | $url = '/'.$url; |
167 | 167 | } |
168 | 168 | } |
169 | 169 | $queryStart = \strpos($url, '?'); |
170 | 170 | if ($queryStart !== false) { |
171 | - $queryString = \substr($url, $queryStart+1); |
|
171 | + $queryString = \substr($url, $queryStart + 1); |
|
172 | 172 | $url = \substr($url, 0, $queryStart); |
173 | 173 | } |
174 | 174 | $this->url = $url; |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | * @param string $method |
47 | 47 | * @param array $parameter |
48 | 48 | */ |
49 | - public function __construct($object, ?array $constructParameter=null, string $method, array $parameter = []) |
|
49 | + public function __construct($object, ?array $constructParameter = null, string $method, array $parameter = []) |
|
50 | 50 | { |
51 | 51 | $this->object = $object; |
52 | 52 | $this->constructParameter = $constructParameter; |
53 | 53 | $this->method = $method; |
54 | 54 | $this->parameter = $parameter; |
55 | 55 | $static = $this->isStatic() ? '->' : '::'; |
56 | - $name = \is_object($object)? \get_class($object) : $object; |
|
56 | + $name = \is_object($object) ? \get_class($object) : $object; |
|
57 | 57 | $this->name = $name.$static.$method; |
58 | 58 | } |
59 | 59 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @return object|null 动态类可获取 |
64 | 64 | */ |
65 | - public function getObjectInstance():?object |
|
65 | + public function getObjectInstance(): ?object |
|
66 | 66 | { |
67 | 67 | if (\is_object($this->object)) { |
68 | 68 | return $this->object; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | if (!is_null($this->requireFile) && !\class_exists($this->object)) { |
74 | 74 | require_once $this->requireFile; |
75 | 75 | } |
76 | - $classRef= new ReflectionClass($this->object); |
|
76 | + $classRef = new ReflectionClass($this->object); |
|
77 | 77 | return $classRef->newInstanceArgs($this->constructParameter); |
78 | 78 | } |
79 | 79 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | if ($this->isStatic() || \is_object($this->object)) { |
84 | 84 | $this->runnableTarget = [$this->object, $this->method]; |
85 | 85 | } |
86 | - $this->runnableTarget = [$this->getObjectInstance() ?? $this->object, $this->method]; |
|
86 | + $this->runnableTarget = [$this->getObjectInstance() ?? $this->object, $this->method]; |
|
87 | 87 | } |
88 | 88 | return $this->runnableTarget; |
89 | 89 | } |