@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | if(isset($this->object->$column)){ |
29 | 29 | if(is_array($this->object->$column) || is_object($this->object->$column)){ |
30 | 30 | $data[$column] = json_encode($this->object->$column); |
31 | - }else{ |
|
31 | + } else{ |
|
32 | 32 | $data[$column] = $this->object->$column; |
33 | 33 | } |
34 | 34 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | if($pk != $column && isset($this->object->$column)){ |
50 | 50 | if(is_array($this->object->$column) || is_object($this->object->$column)){ |
51 | 51 | $data[$column] = json_encode($this->object->$column); |
52 | - }else{ |
|
52 | + } else{ |
|
53 | 53 | $data[$column] = $this->object->$column; |
54 | 54 | } |
55 | 55 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | ->getFirst(); |
32 | 32 | if($row){ |
33 | 33 | return $this->entity->make($row, false); |
34 | - }else{ |
|
34 | + } else{ |
|
35 | 35 | return null; |
36 | 36 | } |
37 | 37 | } |
@@ -20,10 +20,10 @@ |
||
20 | 20 | if(!isset($cur[$p])){ |
21 | 21 | if(count($keys) == 0){ |
22 | 22 | $cur[$p] = $val; |
23 | - }else{ |
|
23 | + } else{ |
|
24 | 24 | $cur[$p] = []; |
25 | 25 | } |
26 | - }else{ |
|
26 | + } else{ |
|
27 | 27 | if(count($keys) == 0){ |
28 | 28 | $cur[$p] = $val; |
29 | 29 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | list($chars, $offset) = $found[0]; |
117 | 117 | if($chars == '\\'){ |
118 | 118 | return $pos+$offset+2; |
119 | - }else{ |
|
119 | + } else{ |
|
120 | 120 | $next = 'stateNormal'; |
121 | 121 | return $pos+$offset+1; |
122 | 122 | } |
@@ -137,7 +137,7 @@ discard block |
||
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 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | { |
147 | 147 | if(isset($this->rawParams[$pos])){ |
148 | 148 | return $this->rawParams[$pos]; |
149 | - }else{ |
|
149 | + } else{ |
|
150 | 150 | return $default; |
151 | 151 | } |
152 | 152 | } |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | if(json_last_error()){ |
159 | 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 | } |
@@ -56,7 +56,7 @@ |
||
56 | 56 | self::isArray($type) or \PhpBoot\abort(new \InvalidArgumentException("$type is not array")); |
57 | 57 | if($type == 'array') { |
58 | 58 | return 'mixed'; |
59 | - }else{ |
|
59 | + } else{ |
|
60 | 60 | return substr($type,0,-2); |
61 | 61 | } |
62 | 62 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 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, |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | if(is_object($val)){ |
31 | 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 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | } |
45 | 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")); |
@@ -28,17 +28,17 @@ discard block |
||
28 | 28 | { |
29 | 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 | } |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | $res = null; |
58 | 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 | 69 | if(is_array($res) || is_object($res)){ |
@@ -88,13 +88,13 @@ discard block |
||
88 | 88 | { |
89 | 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 | } |
@@ -112,13 +112,13 @@ discard block |
||
112 | 112 | { |
113 | 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 | } |
@@ -49,14 +49,14 @@ discard block |
||
49 | 49 | $meta = $this->buildWithoutCache($className); |
50 | 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 | 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 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | foreach ($found as $f){ |
89 | 89 | $this->handleAnnotation($class, $container,$f); //TODO 支持 |
90 | 90 | } |
91 | - }else{ |
|
91 | + } else{ |
|
92 | 92 | $this->handleAnnotation($class, $container, $found); |
93 | 93 | } |
94 | 94 | } |
@@ -62,13 +62,13 @@ |
||
62 | 62 | $meta = self::readWithoutCache($className); |
63 | 63 | $cache->set($key, $meta, 0, $fileName?new ClassModifiedChecker($className):null); |
64 | 64 | return $meta; |
65 | - }catch (\Exception $e){ |
|
65 | + } catch (\Exception $e){ |
|
66 | 66 | $cache->set($key, $e->getMessage(), 0, $fileName?new ClassModifiedChecker($className):null); |
67 | 67 | throw $e; |
68 | 68 | } |
69 | - }elseif(is_string($res)){ |
|
69 | + } elseif(is_string($res)){ |
|
70 | 70 | \PhpBoot\abort($res); |
71 | - }else{ |
|
71 | + } else{ |
|
72 | 72 | return $res; |
73 | 73 | } |
74 | 74 | } |