@@ -15,16 +15,16 @@ |
||
15 | 15 | $keys = explode('.', $key); |
16 | 16 | $keys = array_reverse($keys); |
17 | 17 | $cur = &$arr; |
18 | - while($p = array_pop($keys)){ |
|
18 | + while ($p = array_pop($keys)) { |
|
19 | 19 | $cur instanceof \ArrayAccess || is_array($cur) or \PhpBoot\abort(new \InvalidArgumentException('array or object of ArrayAccess required')); |
20 | - if(!isset($cur[$p])){ |
|
21 | - if(count($keys) == 0){ |
|
20 | + if (!isset($cur[$p])) { |
|
21 | + if (count($keys) == 0) { |
|
22 | 22 | $cur[$p] = $val; |
23 | - }else{ |
|
23 | + }else { |
|
24 | 24 | $cur[$p] = []; |
25 | 25 | } |
26 | - }else{ |
|
27 | - if(count($keys) == 0){ |
|
26 | + }else { |
|
27 | + if (count($keys) == 0) { |
|
28 | 28 | $cur[$p] = $val; |
29 | 29 | } |
30 | 30 | } |
@@ -145,7 +145,7 @@ |
||
145 | 145 | */ |
146 | 146 | static public function getDefaultLogger() |
147 | 147 | { |
148 | - if(!self::$defaultLogger){ |
|
148 | + if (!self::$defaultLogger) { |
|
149 | 149 | self::$defaultLogger = new \Monolog\Logger('default'); |
150 | 150 | } |
151 | 151 | return self::$defaultLogger; |
@@ -7,31 +7,31 @@ discard block |
||
7 | 7 | { |
8 | 8 | public function __construct($text, $limit) |
9 | 9 | { |
10 | - if($limit == 1){ |
|
10 | + if ($limit == 1) { |
|
11 | 11 | $this->rawParams[] = $text; |
12 | 12 | return; |
13 | 13 | } |
14 | - if($limit <= 0){ |
|
14 | + if ($limit<=0) { |
|
15 | 15 | return; |
16 | 16 | } |
17 | 17 | $text = ltrim($text); |
18 | 18 | $pos = 0; |
19 | 19 | $state = 'stateNormal'; |
20 | 20 | $len = strlen($text); |
21 | - if($len == 0){ |
|
21 | + if ($len == 0) { |
|
22 | 22 | return; |
23 | 23 | } |
24 | - while (true){ |
|
25 | - if($state == 'stateNormal' && count($this->rawParams)+1 == $limit){ |
|
24 | + while (true) { |
|
25 | + if ($state == 'stateNormal' && count($this->rawParams) + 1 == $limit) { |
|
26 | 26 | break; |
27 | 27 | } |
28 | 28 | $pos = $this->$state($text, $pos, $state); |
29 | - if($pos === false || $pos>= $len){ |
|
29 | + if ($pos === false || $pos>=$len) { |
|
30 | 30 | break; |
31 | 31 | } |
32 | 32 | }; |
33 | - if($this->prePos != strlen($text)){ |
|
34 | - $this->rawParams[] = substr($text,$this->prePos); |
|
33 | + if ($this->prePos != strlen($text)) { |
|
34 | + $this->rawParams[] = substr($text, $this->prePos); |
|
35 | 35 | } |
36 | 36 | } |
37 | 37 | |
@@ -42,16 +42,16 @@ discard block |
||
42 | 42 | { |
43 | 43 | //查找引号或者空格 |
44 | 44 | $found = []; |
45 | - $todo = substr($text,$pos); |
|
46 | - if(!preg_match('/[\s"\']/', $todo, $found, PREG_OFFSET_CAPTURE) || |
|
47 | - count($found)==0){ |
|
48 | - $this->rawParams[] = substr($text,$this->prePos); |
|
45 | + $todo = substr($text, $pos); |
|
46 | + if (!preg_match('/[\s"\']/', $todo, $found, PREG_OFFSET_CAPTURE) || |
|
47 | + count($found) == 0) { |
|
48 | + $this->rawParams[] = substr($text, $this->prePos); |
|
49 | 49 | $this->prePos = strlen($text); |
50 | 50 | return false; |
51 | 51 | } |
52 | 52 | list($chars, $offset) = $found[0]; |
53 | 53 | |
54 | - if($chars == '"'){ |
|
54 | + if ($chars == '"') { |
|
55 | 55 | $next = 'stateDoubleQ'; |
56 | 56 | return $pos + $offset + 1; |
57 | 57 | } |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | // $next = 'stateSingleQ'; |
60 | 60 | // return $pos + $offset + 1; |
61 | 61 | // } |
62 | - else{ |
|
63 | - $this->rawParams[] = substr($text,$this->prePos, $pos-$this->prePos+$offset); |
|
62 | + else { |
|
63 | + $this->rawParams[] = substr($text, $this->prePos, $pos - $this->prePos + $offset); |
|
64 | 64 | $next = 'stateSpace'; |
65 | 65 | $this->prePos = $pos + $offset + 1; |
66 | 66 | return $this->prePos; |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | private function stateSpace($text, $pos, &$next) |
74 | 74 | { |
75 | 75 | $found = []; |
76 | - $todo = substr($text,$pos); |
|
77 | - if(!preg_match('/\S/', $todo, $found, PREG_OFFSET_CAPTURE) || |
|
78 | - count($found)==0){ |
|
76 | + $todo = substr($text, $pos); |
|
77 | + if (!preg_match('/\S/', $todo, $found, PREG_OFFSET_CAPTURE) || |
|
78 | + count($found) == 0) { |
|
79 | 79 | return false; |
80 | 80 | } |
81 | 81 | list($chars, $offset) = $found[0]; |
@@ -105,20 +105,20 @@ discard block |
||
105 | 105 | /** |
106 | 106 | * 进入双引号状态 |
107 | 107 | */ |
108 | - private function stateDoubleQ($text, $pos, &$next){ |
|
108 | + private function stateDoubleQ($text, $pos, &$next) { |
|
109 | 109 | |
110 | 110 | $found = []; |
111 | - $todo = substr($text,$pos); |
|
112 | - if(!preg_match('/[\\\\"]/', $todo, $found, PREG_OFFSET_CAPTURE) || |
|
113 | - count($found)==0){ |
|
111 | + $todo = substr($text, $pos); |
|
112 | + if (!preg_match('/[\\\\"]/', $todo, $found, PREG_OFFSET_CAPTURE) || |
|
113 | + count($found) == 0) { |
|
114 | 114 | return false; |
115 | 115 | } |
116 | 116 | list($chars, $offset) = $found[0]; |
117 | - if($chars == '\\'){ |
|
118 | - return $pos+$offset+2; |
|
119 | - }else{ |
|
117 | + if ($chars == '\\') { |
|
118 | + return $pos + $offset + 2; |
|
119 | + }else { |
|
120 | 120 | $next = 'stateNormal'; |
121 | - return $pos+$offset+1; |
|
121 | + return $pos + $offset + 1; |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 | |
@@ -127,38 +127,38 @@ discard block |
||
127 | 127 | return count($this->rawParams); |
128 | 128 | } |
129 | 129 | |
130 | - public function getParam($pos, $default = null, $ignoreError=false) |
|
130 | + public function getParam($pos, $default = null, $ignoreError = false) |
|
131 | 131 | { |
132 | - if(isset($this->cachedParams[$pos])){ |
|
132 | + if (isset($this->cachedParams[$pos])) { |
|
133 | 133 | return $this->cachedParams[$pos]; |
134 | 134 | } |
135 | - if(isset($this->rawParams[$pos])){ |
|
135 | + if (isset($this->rawParams[$pos])) { |
|
136 | 136 | $param = $this->rawParams[$pos]; |
137 | 137 | $param = $this->stripSlashes($param, $ignoreError); |
138 | 138 | $this->cachedParams[$pos] = $param; |
139 | 139 | return $param; |
140 | - }else{ |
|
140 | + }else { |
|
141 | 141 | return $default; |
142 | 142 | } |
143 | 143 | } |
144 | 144 | |
145 | 145 | public function getRawParam($pos, $default = null) |
146 | 146 | { |
147 | - if(isset($this->rawParams[$pos])){ |
|
147 | + if (isset($this->rawParams[$pos])) { |
|
148 | 148 | return $this->rawParams[$pos]; |
149 | - }else{ |
|
149 | + }else { |
|
150 | 150 | return $default; |
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
154 | 154 | private function stripSlashes($text, $ignoreError) |
155 | 155 | { |
156 | - if(strlen($text)>=2 && substr($text,0,1) == '"'){ |
|
156 | + if (strlen($text)>=2 && substr($text, 0, 1) == '"') { |
|
157 | 157 | $decoded = json_decode($text); |
158 | - if(json_last_error()){ |
|
159 | - if($ignoreError){ |
|
158 | + if (json_last_error()) { |
|
159 | + if ($ignoreError) { |
|
160 | 160 | return $text; |
161 | - }else{ |
|
161 | + }else { |
|
162 | 162 | \PhpBoot\abort('json_decode failed with '.json_last_error_msg(), [$text]); |
163 | 163 | } |
164 | 164 | } |
@@ -14,10 +14,10 @@ discard block |
||
14 | 14 | * @param string $type 需要标准化的字符串 |
15 | 15 | * @param string $contextClass 当前上下文所在的类,一般传__CLASS__, 用于扫描当前文件的use信息, 以便拼上namespace |
16 | 16 | */ |
17 | - static function normalize($type, $contextClass=null){ |
|
17 | + static function normalize($type, $contextClass = null) { |
|
18 | 18 | $resolver = new TypeResolver(); |
19 | 19 | $context = null; |
20 | - if($contextClass){ |
|
20 | + if ($contextClass) { |
|
21 | 21 | //TODO 优化性能 |
22 | 22 | $contextFactory = new ContextFactory(); |
23 | 23 | $context = $contextFactory->createFromReflector(new \ReflectionClass($contextClass)); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * 是否是基本类型 |
31 | 31 | * @param string $type |
32 | 32 | */ |
33 | - static function isScalarType($type){ |
|
33 | + static function isScalarType($type) { |
|
34 | 34 | return in_array($type, [ |
35 | 35 | 'bool', |
36 | 36 | 'int', |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @param $type |
44 | 44 | * @return bool |
45 | 45 | */ |
46 | - static function isArray($type){ |
|
46 | + static function isArray($type) { |
|
47 | 47 | return ($type == 'array' || substr($type, -2) == '[]'); |
48 | 48 | } |
49 | 49 | |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | * @param $type |
53 | 53 | * @return string|null |
54 | 54 | */ |
55 | - static function getArrayType($type){ |
|
55 | + static function getArrayType($type) { |
|
56 | 56 | self::isArray($type) or \PhpBoot\abort(new \InvalidArgumentException("$type is not array")); |
57 | - if($type == 'array') { |
|
57 | + if ($type == 'array') { |
|
58 | 58 | return 'mixed'; |
59 | - }else{ |
|
60 | - return substr($type,0,-2); |
|
59 | + }else { |
|
60 | + return substr($type, 0, -2); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | } |
64 | 64 | \ No newline at end of file |
@@ -14,46 +14,46 @@ |
||
14 | 14 | { |
15 | 15 | TypeHint::isScalarType($type) or \PhpBoot\abort(new \InvalidArgumentException("$type is not scalar type")); |
16 | 16 | |
17 | - if(is_bool($val)){ |
|
17 | + if (is_bool($val)) { |
|
18 | 18 | $val = intval($val); |
19 | - }else if($val === null){ |
|
19 | + }else if ($val === null) { |
|
20 | 20 | $map = [ |
21 | 21 | 'string'=>'', |
22 | 22 | 'bool'=>false, |
23 | 23 | 'int'=>0, |
24 | 24 | 'float'=>0, |
25 | 25 | ]; |
26 | - if(isset($map[$type])){ |
|
26 | + if (isset($map[$type])) { |
|
27 | 27 | $val = $map[$type]; |
28 | 28 | } |
29 | 29 | } |
30 | - if(is_object($val)){ |
|
31 | - try{ |
|
30 | + if (is_object($val)) { |
|
31 | + try { |
|
32 | 32 | $val = (string)$val; |
33 | - }catch (\Exception $e){ |
|
33 | + }catch (\Exception $e) { |
|
34 | 34 | $className = get_class($val); |
35 | 35 | \PhpBoot\abort(new \InvalidArgumentException("could not cast value from class $className to {$type}")); |
36 | 36 | } |
37 | 37 | |
38 | 38 | } |
39 | - if(is_array($val)){ |
|
40 | - $type == 'array' || $type =='mixed' || !$type or \PhpBoot\abort(new \InvalidArgumentException("could not cast value from resource to {$type}")); |
|
39 | + if (is_array($val)) { |
|
40 | + $type == 'array' || $type == 'mixed' || !$type or \PhpBoot\abort(new \InvalidArgumentException("could not cast value from resource to {$type}")); |
|
41 | 41 | } |
42 | - if(is_resource($val)) { |
|
42 | + if (is_resource($val)) { |
|
43 | 43 | \PhpBoot\abort(new \InvalidArgumentException("could not cast value from resource to {$type}")); |
44 | 44 | } |
45 | - if(!$validate){ |
|
45 | + if (!$validate) { |
|
46 | 46 | settype($val, $type) or \PhpBoot\abort(new \InvalidArgumentException("cast value($val) to {$type} failed")); |
47 | - }else{ |
|
47 | + }else { |
|
48 | 48 | $ori = $val; |
49 | 49 | $oriType = gettype($val); |
50 | 50 | settype($val, $type) or \PhpBoot\abort(new \InvalidArgumentException("cast value($ori) to type {$type} failed")); |
51 | 51 | $newData = $val; |
52 | - if(is_bool($newData)){ |
|
52 | + if (is_bool($newData)) { |
|
53 | 53 | $newData = intval($newData); |
54 | 54 | } |
55 | 55 | settype($newData, $oriType) or \PhpBoot\abort(new \InvalidArgumentException("cast value($ori) to type {$type} failed")); |
56 | - if($ori != $newData){ |
|
56 | + if ($ori != $newData) { |
|
57 | 57 | \PhpBoot\abort(new \InvalidArgumentException("could not cast value($ori) to type {$type}")); |
58 | 58 | } |
59 | 59 | } |
@@ -16,15 +16,15 @@ |
||
16 | 16 | * @param boolean $overwrite 是否覆盖已有文件 |
17 | 17 | * @return boolean |
18 | 18 | */ |
19 | - static public function write($path, $data, $overwrite = true){ |
|
19 | + static public function write($path, $data, $overwrite = true) { |
|
20 | 20 | $path = str_replace('\\', '/', $path); |
21 | 21 | $fileDir = dirname($path); |
22 | 22 | $tmpFile = tempnam($fileDir); |
23 | 23 | false !== @file_put_contents($tmpFile, $data) or \PhpBoot\abort("write to file: $tmpFile failed"); |
24 | - if($overwrite){ |
|
24 | + if ($overwrite) { |
|
25 | 25 | @unlink($path); //删除原始文件 |
26 | 26 | } |
27 | - if(!@rename($tmpFile, $path)){ |
|
27 | + if (!@rename($tmpFile, $path)) { |
|
28 | 28 | @unlink($tmpFile); //删除原始文件 |
29 | 29 | \PhpBoot\abort("write to file: $tmpFile failed"); |
30 | 30 | return false; |
@@ -26,19 +26,19 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function offsetExists($offset) |
28 | 28 | { |
29 | - if(is_array($this->obj)){ |
|
29 | + if (is_array($this->obj)) { |
|
30 | 30 | return array_key_exists($offset, $this->obj); |
31 | - }elseif(self::hasProperty($this->obj, $offset)){ |
|
31 | + }elseif (self::hasProperty($this->obj, $offset)) { |
|
32 | 32 | return true; |
33 | - }elseif(method_exists($this->obj, 'has')){ |
|
33 | + }elseif (method_exists($this->obj, 'has')) { |
|
34 | 34 | return $this->obj->has($offset); |
35 | - }elseif(method_exists($this->obj, $method = 'has'.ucfirst($offset))){ |
|
35 | + }elseif (method_exists($this->obj, $method = 'has'.ucfirst($offset))) { |
|
36 | 36 | return $this->obj->{$method}($offset); |
37 | - }elseif(method_exists($this->obj, $method = 'get'.ucfirst($offset))){ |
|
37 | + }elseif (method_exists($this->obj, $method = 'get'.ucfirst($offset))) { |
|
38 | 38 | return $this->obj->{$method}() !== null; |
39 | - }elseif(method_exists($this->obj, 'get')){ |
|
39 | + }elseif (method_exists($this->obj, 'get')) { |
|
40 | 40 | return $this->obj->get($offset) !== null; |
41 | - }else{ |
|
41 | + }else { |
|
42 | 42 | return false; |
43 | 43 | } |
44 | 44 | } |
@@ -55,18 +55,18 @@ discard block |
||
55 | 55 | public function offsetGet($offset) |
56 | 56 | { |
57 | 57 | $res = null; |
58 | - if(is_array($this->obj)){ |
|
58 | + if (is_array($this->obj)) { |
|
59 | 59 | $res = &$this->obj[$offset]; |
60 | - }elseif(self::hasProperty($this->obj, $offset)){ |
|
60 | + }elseif (self::hasProperty($this->obj, $offset)) { |
|
61 | 61 | $res = &$this->obj->{$offset}; |
62 | - }elseif(method_exists($this->obj, 'get')){ |
|
62 | + }elseif (method_exists($this->obj, 'get')) { |
|
63 | 63 | $res = $this->obj->get($offset); |
64 | - }elseif(method_exists($this->obj, $method = 'get'.ucfirst($offset))){ |
|
64 | + }elseif (method_exists($this->obj, $method = 'get'.ucfirst($offset))) { |
|
65 | 65 | $res = $this->obj->{$method}(); |
66 | - }else{ |
|
66 | + }else { |
|
67 | 67 | throw new \InvalidArgumentException("offsetGet($offset) failed"); |
68 | 68 | } |
69 | - if(is_array($res) || is_object($res)){ |
|
69 | + if (is_array($res) || is_object($res)) { |
|
70 | 70 | return new self($res); |
71 | 71 | } |
72 | 72 | return $res; |
@@ -86,15 +86,15 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function offsetSet($offset, $value) |
88 | 88 | { |
89 | - if(is_array($this->obj)){ |
|
89 | + if (is_array($this->obj)) { |
|
90 | 90 | $this->obj[$offset] = $value; |
91 | - }elseif(self::hasProperty($this->obj, $offset)){ |
|
91 | + }elseif (self::hasProperty($this->obj, $offset)) { |
|
92 | 92 | $this->obj->{$offset} = $value; |
93 | - }elseif(method_exists($this->obj, 'set')){ |
|
93 | + }elseif (method_exists($this->obj, 'set')) { |
|
94 | 94 | $this->obj->set($offset, $value); |
95 | - }elseif(method_exists($this->obj, $method = 'set'.ucfirst($offset))){ |
|
95 | + }elseif (method_exists($this->obj, $method = 'set'.ucfirst($offset))) { |
|
96 | 96 | $this->obj->{$method}($value); |
97 | - }else{ |
|
97 | + }else { |
|
98 | 98 | throw new \BadMethodCallException("can not set $offset"); |
99 | 99 | } |
100 | 100 | } |
@@ -110,35 +110,35 @@ discard block |
||
110 | 110 | */ |
111 | 111 | public function offsetUnset($offset) |
112 | 112 | { |
113 | - if(is_array($this->obj)){ |
|
113 | + if (is_array($this->obj)) { |
|
114 | 114 | unset($this->obj[$offset]); |
115 | - }elseif(self::hasProperty($this->obj, $offset)){ |
|
115 | + }elseif (self::hasProperty($this->obj, $offset)) { |
|
116 | 116 | unset($this->obj->{$offset}); |
117 | - }elseif(method_exists($this->obj, 'remove')){ |
|
117 | + }elseif (method_exists($this->obj, 'remove')) { |
|
118 | 118 | $this->obj->remove($offset); |
119 | - }elseif(method_exists($this->obj, $method = 'remove'.ucfirst($offset))){ |
|
119 | + }elseif (method_exists($this->obj, $method = 'remove'.ucfirst($offset))) { |
|
120 | 120 | $this->obj->$method(); |
121 | - }else{ |
|
121 | + }else { |
|
122 | 122 | throw new \InvalidArgumentException("offsetUnset($offset) failed"); |
123 | 123 | } |
124 | 124 | } |
125 | - static public function strip($obj){ |
|
126 | - if($obj instanceof self){ |
|
125 | + static public function strip($obj) { |
|
126 | + if ($obj instanceof self) { |
|
127 | 127 | return $obj->obj; |
128 | 128 | } |
129 | 129 | return $obj; |
130 | 130 | } |
131 | 131 | static function hasProperty($object, $name) |
132 | 132 | { |
133 | - if(!is_object($object)){ |
|
133 | + if (!is_object($object)) { |
|
134 | 134 | return false; |
135 | 135 | } |
136 | 136 | $class = new \ReflectionClass($object); |
137 | - if(!$class->hasProperty($name)){ |
|
137 | + if (!$class->hasProperty($name)) { |
|
138 | 138 | return false; |
139 | 139 | } |
140 | 140 | $property = $class->getProperty($name); |
141 | - if(!$property){ |
|
141 | + if (!$property) { |
|
142 | 142 | return false; |
143 | 143 | } |
144 | 144 | return $property->isPublic(); |
@@ -41,22 +41,22 @@ discard block |
||
41 | 41 | //TODO【重要】 使用全局的缓存版本号, 而不是针对每个文件判断缓存过期与否 |
42 | 42 | $rfl = new \ReflectionClass($className) or \PhpBoot\abort("load class $className failed"); |
43 | 43 | $fileName = $rfl->getFileName(); |
44 | - $key = str_replace('\\','.',get_class($this)).md5(serialize($this->annotations).$fileName.$className); |
|
44 | + $key = str_replace('\\', '.', get_class($this)).md5(serialize($this->annotations).$fileName.$className); |
|
45 | 45 | $cache = new CheckableCache($this->cache); |
46 | 46 | $res = $cache->get($key, $this); |
47 | - if($res === $this){ |
|
48 | - try{ |
|
47 | + if ($res === $this) { |
|
48 | + try { |
|
49 | 49 | $meta = $this->buildWithoutCache($className); |
50 | - $cache->set($key, $meta, 0, $fileName?new ClassModifiedChecker($className):null); |
|
50 | + $cache->set($key, $meta, 0, $fileName ? new ClassModifiedChecker($className) : null); |
|
51 | 51 | return $meta; |
52 | - }catch (\Exception $e){ |
|
52 | + }catch (\Exception $e) { |
|
53 | 53 | Logger::warning(__METHOD__.' failed with '.$e->getMessage()); |
54 | - $cache->set($key, $e->getMessage(), 0, $fileName?new ClassModifiedChecker($className):null); |
|
54 | + $cache->set($key, $e->getMessage(), 0, $fileName ? new ClassModifiedChecker($className) : null); |
|
55 | 55 | throw $e; |
56 | 56 | } |
57 | - }elseif(is_string($res)){ |
|
57 | + }elseif (is_string($res)) { |
|
58 | 58 | \PhpBoot\abort($res); |
59 | - }else{ |
|
59 | + }else { |
|
60 | 60 | return $res; |
61 | 61 | } |
62 | 62 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | abstract protected function createContainer($className); |
69 | 69 | |
70 | 70 | |
71 | - protected function handleAnnotation($handlerName, $container, $ann){ |
|
71 | + protected function handleAnnotation($handlerName, $container, $ann) { |
|
72 | 72 | $handler = new $handlerName(); |
73 | 73 | return $handler($container, $ann); |
74 | 74 | } |
@@ -80,15 +80,15 @@ discard block |
||
80 | 80 | { |
81 | 81 | $container = $this->createContainer($className); |
82 | 82 | $anns = AnnotationReader::read($className, $this->cache); |
83 | - foreach ($this->annotations as $i){ |
|
83 | + foreach ($this->annotations as $i) { |
|
84 | 84 | list($class, $target) = $i; |
85 | 85 | |
86 | 86 | $found = \JmesPath\search($target, $anns); |
87 | - if(is_array($found)){ |
|
88 | - foreach ($found as $f){ |
|
89 | - $this->handleAnnotation($class, $container,$f); //TODO 支持 |
|
87 | + if (is_array($found)) { |
|
88 | + foreach ($found as $f) { |
|
89 | + $this->handleAnnotation($class, $container, $f); //TODO 支持 |
|
90 | 90 | } |
91 | - }else{ |
|
91 | + }else { |
|
92 | 92 | $this->handleAnnotation($class, $container, $found); |
93 | 93 | } |
94 | 94 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | /** |
99 | 99 | * @var array |
100 | 100 | */ |
101 | - private $annotations=[]; |
|
101 | + private $annotations = []; |
|
102 | 102 | /** |
103 | 103 | * @var Cache |
104 | 104 | */ |
@@ -13,11 +13,11 @@ discard block |
||
13 | 13 | * @param AnnotationTag[] $children |
14 | 14 | * @param AnnotationBlock|null $parent |
15 | 15 | */ |
16 | - public function __construct($name='', |
|
17 | - $summary='', |
|
18 | - $description='', |
|
19 | - $children=[], |
|
20 | - $parent=null) |
|
16 | + public function __construct($name = '', |
|
17 | + $summary = '', |
|
18 | + $description = '', |
|
19 | + $children = [], |
|
20 | + $parent = null) |
|
21 | 21 | { |
22 | 22 | $this->name = $name; |
23 | 23 | $this->summary = $summary; |
@@ -37,11 +37,11 @@ discard block |
||
37 | 37 | /** |
38 | 38 | * @var string |
39 | 39 | */ |
40 | - public $description=''; |
|
40 | + public $description = ''; |
|
41 | 41 | /** |
42 | 42 | * @var AnnotationTag[] |
43 | 43 | */ |
44 | - public $children=[]; |
|
44 | + public $children = []; |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * @var AnnotationTag|null |