@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | public function appendSql($sql, $addSpace=true){ |
18 | 18 | if($this->sql == ''){ |
19 | 19 | $this->sql = $sql; |
20 | - }else{ |
|
20 | + } else{ |
|
21 | 21 | if($addSpace){ |
22 | 22 | $this->sql = $this->sql.' '.$sql; |
23 | - }else{ |
|
23 | + } else{ |
|
24 | 24 | $this->sql = $this->sql.$sql; |
25 | 25 | } |
26 | 26 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | { |
38 | 38 | if($resultHandler = $this->resultHandler){ |
39 | 39 | return $resultHandler($result); |
40 | - }else{ |
|
40 | + } else{ |
|
41 | 41 | return $result; |
42 | 42 | } |
43 | 43 | } |
@@ -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 | } |
@@ -213,9 +213,9 @@ discard block |
||
213 | 213 | { |
214 | 214 | if ($content instanceof ReturnMeta || $content instanceof ParamMeta) { |
215 | 215 | return $this->makeExample($content->container); |
216 | - }elseif ($content instanceof TypeContainerInterface){ |
|
216 | + } elseif ($content instanceof TypeContainerInterface){ |
|
217 | 217 | return $content->makeExample(); |
218 | - }elseif(is_array($content)) { |
|
218 | + } elseif(is_array($content)) { |
|
219 | 219 | $res = []; |
220 | 220 | foreach ($content as $k => $v) { |
221 | 221 | $res[$k] = $this->makeExample($v); |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | $paramSchema = new PrimitiveSchemaObject(); |
371 | 371 | if($isFile){ |
372 | 372 | $paramSchema->type = 'file'; |
373 | - }else{ |
|
373 | + } else{ |
|
374 | 374 | $paramSchema->type = self::mapType($param->type); |
375 | 375 | self::mapValidation($param->validation, $paramSchema); |
376 | 376 | } |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | } elseif($container == null){ |
429 | 429 | $schema = null ;//new PrimitiveSchemaObject(); |
430 | 430 | //$schema->type = null; |
431 | - }else { |
|
431 | + } else { |
|
432 | 432 | $schema = new PrimitiveSchemaObject(); |
433 | 433 | //$schema->type = 'mixed'; |
434 | 434 | } |
@@ -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; |