@@ -45,7 +45,7 @@ |
||
45 | 45 | { |
46 | 46 | if($annotations){ |
47 | 47 | parent::__construct($annotations, $cache); |
48 | - }else{ |
|
48 | + } else{ |
|
49 | 49 | parent::__construct(self::$DEFAULT_ANNOTATIONS, $cache); |
50 | 50 | } |
51 | 51 |
@@ -18,7 +18,7 @@ |
||
18 | 18 | return new Response($e->getMessage(), $e->getStatusCode()); |
19 | 19 | } if($e instanceof \InvalidArgumentException){ |
20 | 20 | return new Response($e->getMessage(), Response::HTTP_BAD_REQUEST); |
21 | - }else{ |
|
21 | + } else{ |
|
22 | 22 | return new Response($e->getMessage(), Response::HTTP_INTERNAL_SERVER_ERROR); |
23 | 23 | } |
24 | 24 | } |
@@ -53,7 +53,7 @@ |
||
53 | 53 | public function handler(Application $app, callable $call){ |
54 | 54 | try{ |
55 | 55 | return $call(); |
56 | - }catch (\Exception $e){ |
|
56 | + } catch (\Exception $e){ |
|
57 | 57 | $renderer = $app->get(ExceptionRenderer::class); //TODO 放在这里是否合适 |
58 | 58 | return $renderer->render($e); |
59 | 59 | } |
@@ -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("param $source is required")); |
56 | 56 | $inputs[$meta->name] = $meta->default; |
57 | 57 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | foreach ($this->paramMetas as $meta){ |
70 | 70 | if($meta->isPassedByReference){ |
71 | 71 | $params[$pos] = &$reference[$meta->name]; |
72 | - }else{ |
|
72 | + } else{ |
|
73 | 73 | $params[$pos] = $inputs[$meta->name]; |
74 | 74 | } |
75 | 75 | $pos++; |
@@ -25,13 +25,13 @@ |
||
25 | 25 | $params = new AnnotationParams($text, 2); |
26 | 26 | $paramName = substr($params->getParam(0), 1); |
27 | 27 | $paramDoc = $params->getRawParam(1, ''); |
28 | - }else{ |
|
28 | + } else{ |
|
29 | 29 | $params = new AnnotationParams($text, 3); |
30 | 30 | if ($params->count() >=2 && substr($params->getParam(1), 0, 1) == '$'){ |
31 | 31 | $paramType = $params->getParam(0); //TODO 检测类型是否合法 |
32 | 32 | $paramName = substr($params->getParam(1), 1); |
33 | 33 | $paramDoc = $params->getRawParam(2, ''); |
34 | - }else{ |
|
34 | + } else{ |
|
35 | 35 | \PhpBoot\abort(new AnnotationSyntaxException("@param $text syntax error")); |
36 | 36 | } |
37 | 37 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $handler->setMapping($params[0], $return); |
45 | 45 | } |
46 | 46 | |
47 | - }elseif($ann->parent->name == 'param'){ |
|
47 | + } elseif($ann->parent->name == 'param'){ |
|
48 | 48 | list($paramType, $paramName, $paramDoc) = ParamAnnotationHandler::getParamInfo($ann->parent->description); |
49 | 49 | |
50 | 50 | $paramMeta = $route->getRequestHandler()->getParamMeta($paramName); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | ContainerFactory::create($entityBuilder, $paramMeta->type) |
60 | 60 | ) |
61 | 61 | ); |
62 | - }else{ |
|
62 | + } else{ |
|
63 | 63 | $paramMeta->source = $params[0]; |
64 | 64 | } |
65 | 65 | } |
@@ -38,7 +38,7 @@ |
||
38 | 38 | $paramMeta = $route->getRequestHandler()->getParamMeta($paramName); |
39 | 39 | if($params->count()>1){ |
40 | 40 | $paramMeta->validation = [$params[0], $params[1]]; |
41 | - }else{ |
|
41 | + } else{ |
|
42 | 42 | $paramMeta->validation = $params[0]; |
43 | 43 | if($paramMeta->validation) { |
44 | 44 | $v = new Validator(); |
@@ -63,7 +63,7 @@ |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | } |
66 | - }else if ($ttl != 0 && ($createdTime + $ttl < time())) { |
|
66 | + } else if ($ttl != 0 && ($createdTime + $ttl < time())) { |
|
67 | 67 | $this->impl->delete($name); |
68 | 68 | return $default; |
69 | 69 | } |
@@ -14,14 +14,14 @@ |
||
14 | 14 | $fileNames = array(); |
15 | 15 | if(is_string($fileName)){ |
16 | 16 | $fileNames[]=$fileName; |
17 | - }else{ |
|
17 | + } else{ |
|
18 | 18 | is_array($fileName) or \PhpBoot\abort(new \InvalidArgumentException("string or array is required by param 0")); |
19 | 19 | $fileNames = $fileName; |
20 | 20 | } |
21 | 21 | foreach ($fileNames as $fileName){ |
22 | 22 | if(is_file($fileName)){ |
23 | 23 | $this->fileName[$fileName] = @filemtime($fileName); |
24 | - }else { |
|
24 | + } else { |
|
25 | 25 | $this->fileName[$fileName] = @filemtime($fileName); |
26 | 26 | if(!is_dir($fileName)){ |
27 | 27 | continue; |