@@ -63,7 +63,7 @@ |
||
63 | 63 | if($pos !== false){ |
64 | 64 | $this->snippets[$ori] = substr($str, $ori, $pos-$ori); |
65 | 65 | $pos ++; |
66 | - }else{ |
|
66 | + } else{ |
|
67 | 67 | $this->snippets[$ori] = substr($str, $ori); |
68 | 68 | } |
69 | 69 | return $pos; |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | $this->threads[] = function ()use($thread, $pos){ |
20 | 20 | try{ |
21 | 21 | $this->threadResults[$pos][0] = $thread(); |
22 | - }catch (\Exception $e){ |
|
22 | + } catch (\Exception $e){ |
|
23 | 23 | $this->threadResults[$pos][1] = $e; |
24 | 24 | } |
25 | 25 | }; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $res = array_pop($this->waitResults); |
56 | 56 | if(isset($res[1])){ |
57 | 57 | \PhpBoot\abort(new RpcException($res['reason'])); |
58 | - }else{ |
|
58 | + } else{ |
|
59 | 59 | return $res[0]; |
60 | 60 | } |
61 | 61 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $op = $this->http->sendAsync($request); |
53 | 53 | $res = MultiRpc::wait($op); |
54 | 54 | return $this->mapResponse($method, $route, $res, $args); |
55 | - }else{ |
|
55 | + } else{ |
|
56 | 56 | $res = $this->http->send($request); |
57 | 57 | return $this->mapResponse($method, $route, $res, $args); |
58 | 58 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $query[$k] = $v; |
134 | 134 | } |
135 | 135 | } |
136 | - }else{ |
|
136 | + } else{ |
|
137 | 137 | foreach ($request as $k => $v){ |
138 | 138 | if(!in_array($k, ['query', 'request', 'files', 'cookies', 'headers'])){ |
139 | 139 | if($body === null){ |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | ArrayHelper::set($mapping, $return->source, $data); |
206 | 206 | } |
207 | 207 | |
208 | - }else{ |
|
208 | + } else{ |
|
209 | 209 | |
210 | 210 | //TODO 如果多个 异常对应同一个 statusCode 怎么处理 |
211 | 211 | $exceptions = $route->getExceptionHandler()->getExceptions(); |
@@ -26,7 +26,7 @@ |
||
26 | 26 | foreach (Promise\settle($promises)->wait() as $i){ |
27 | 27 | if(isset($i['reason'])){ |
28 | 28 | $res[] = [null, new RpcException($i['reason'])]; |
29 | - }else{ |
|
29 | + } else{ |
|
30 | 30 | $res[] = [$i['value'], null]; |
31 | 31 | } |
32 | 32 | } |
@@ -23,11 +23,11 @@ |
||
23 | 23 | $value = json_encode($value, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); |
24 | 24 | //} |
25 | 25 | $response->setContent($value); |
26 | - }elseif($key == 'headers'){ |
|
26 | + } elseif($key == 'headers'){ |
|
27 | 27 | foreach ($value as $k=>$v){ |
28 | 28 | $response->headers->set($k, $v); |
29 | 29 | } |
30 | - }else{ |
|
30 | + } else{ |
|
31 | 31 | \PhpBoot\abort(new \UnexpectedValueException("Unexpected output target $key")); |
32 | 32 | } |
33 | 33 |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $source = "request.$paramName"; |
85 | 85 | if($route->hasPathParam($paramName)){ //参数来自路由 |
86 | 86 | $source = "request.$paramName"; |
87 | - }elseif($httpMethod == 'GET'){ |
|
87 | + } elseif($httpMethod == 'GET'){ |
|
88 | 88 | $source = "request.$paramName"; //GET请求显示指定来自query string |
89 | 89 | } |
90 | 90 | $paramClass = $param->getClass(); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $requestHandler->setParamMetas($paramsMeta); |
117 | 117 | if(!$hasRefParam){ |
118 | 118 | $responseHandler->setMapping('response.content', new ReturnMeta('return','mixed','', new MixedTypeContainer())); |
119 | - }else{ |
|
119 | + } else{ |
|
120 | 120 | //当存在引用参数作为输出时, 默认将 return 数据绑定的到 data 下, 以防止和引用参数作为输出重叠 |
121 | 121 | $responseHandler->setMapping($this->returnTarget, new ReturnMeta('return','mixed','', new MixedTypeContainer())); |
122 | 122 | } |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | $obj = new SelectRule(new Context($this->connection)); |
102 | 102 | if($column0 == null){ |
103 | 103 | $args = ['*']; |
104 | - }elseif(is_array($column0)){ |
|
104 | + } elseif(is_array($column0)){ |
|
105 | 105 | $args = $column0; |
106 | - }else{ |
|
106 | + } else{ |
|
107 | 107 | $args = func_get_args(); |
108 | 108 | } |
109 | 109 | foreach ($args as &$arg){ |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $res = $callback($this); |
171 | 171 | $this->getConnection()->commit() or \PhpBoot\abort('commit failed'); |
172 | 172 | return $res; |
173 | - }catch (\Exception $e){ |
|
173 | + } catch (\Exception $e){ |
|
174 | 174 | $this->getConnection()->rollBack(); |
175 | 175 | Logger::warning('commit failed with '.get_class($e).' '.$e->getMessage()); |
176 | 176 | throw $e; |
@@ -45,13 +45,13 @@ discard block |
||
45 | 45 | } |
46 | 46 | if($meta->container){ |
47 | 47 | $inputs[$meta->name] = $meta->container->make($source); |
48 | - }else{ |
|
48 | + } else{ |
|
49 | 49 | $inputs[$meta->name] = $source; |
50 | 50 | } |
51 | 51 | if($meta->validation){ |
52 | 52 | $vld->rule($meta->validation, $meta->name); |
53 | 53 | } |
54 | - }else{ |
|
54 | + } else{ |
|
55 | 55 | $meta->isOptional or \PhpBoot\abort(new BadRequestHttpException("the parameter \"{$meta->source}\" is missing")); |
56 | 56 | $inputs[$meta->name] = $meta->default; |
57 | 57 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | foreach ($this->paramMetas as $meta){ |
71 | 71 | if($meta->isPassedByReference){ |
72 | 72 | $params[$pos] = &$reference[$meta->name]; |
73 | - }else{ |
|
73 | + } else{ |
|
74 | 74 | $params[$pos] = $inputs[$meta->name]; |
75 | 75 | } |
76 | 76 | $pos++; |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | } |
185 | 185 | if($this->isTheFirst){ |
186 | 186 | WhereImpl::where($this->context, 'HAVING', $expr, array_slice(func_get_args(), 1)); |
187 | - }else{ |
|
187 | + } else{ |
|
188 | 188 | WhereImpl::where($this->context, 'AND', $expr, array_slice(func_get_args(), 1)); |
189 | 189 | } |
190 | 190 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | } |
274 | 274 | if($this->isTheFirst){ |
275 | 275 | WhereImpl::where($this->context, 'WHERE' ,$conditions, array_slice(func_get_args(), 1)); |
276 | - }else{ |
|
276 | + } else{ |
|
277 | 277 | WhereImpl::where($this->context, 'AND', $conditions, array_slice(func_get_args(), 1)); |
278 | 278 | } |
279 | 279 | return new NextWhereRule($this->context, false); |