@@ -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 | |
@@ -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 | } |
@@ -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; |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $default += [ |
| 88 | 88 | Cache::class => \DI\object(ApcCache::class) |
| 89 | 89 | ]; |
| 90 | - }else{ |
|
| 90 | + } else{ |
|
| 91 | 91 | $default += [ |
| 92 | 92 | Cache::class => \DI\object(FilesystemCache::class) |
| 93 | 93 | ->constructorParameter('directory', sys_get_temp_dir()) |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | } |
| 271 | 271 | return $next($request); |
| 272 | 272 | |
| 273 | - }elseif ($res[0] == Dispatcher::NOT_FOUND) { |
|
| 273 | + } elseif ($res[0] == Dispatcher::NOT_FOUND) { |
|
| 274 | 274 | \PhpBoot\abort(new NotFoundHttpException(), [$request->getMethod(), $uri]); |
| 275 | 275 | } elseif ($res[0] == Dispatcher::METHOD_NOT_ALLOWED) { |
| 276 | 276 | \PhpBoot\abort(new MethodNotAllowedHttpException($res[1]), [$request->getMethod(), $uri]); |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | } |
| 295 | 295 | return $response; |
| 296 | 296 | |
| 297 | - }catch (\Exception $e){ |
|
| 297 | + } catch (\Exception $e){ |
|
| 298 | 298 | $renderer->render($e); |
| 299 | 299 | } |
| 300 | 300 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | if($error instanceof \Exception){ |
| 22 | 22 | $e = $error; |
| 23 | 23 | $message = "exception '".get_class($error)."' with message {$error->getMessage()}"; |
| 24 | - }else{ |
|
| 24 | + } else{ |
|
| 25 | 25 | $e = new \RuntimeException($error); |
| 26 | 26 | $message = $error; |
| 27 | 27 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | if($e->getFile() == __FILE__){ |
| 31 | 31 | $file = $trace[0]['file']; |
| 32 | 32 | $line = $trace[0]['line']; |
| 33 | - }else{ |
|
| 33 | + } else{ |
|
| 34 | 34 | $file = $e->getFile(); |
| 35 | 35 | $line = $e->getLine(); |
| 36 | 36 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | { |
| 54 | 54 | if(is_object($entity)){ |
| 55 | 55 | return $db->getApp()->make(ModelWithObject::class, ['db'=>$db, 'entity'=>$entity]); |
| 56 | - }else{ |
|
| 56 | + } else{ |
|
| 57 | 57 | return $db->getApp()->make(ModelWithClass::class, ['db'=>$db, 'entityName'=>$entity]); |
| 58 | 58 | } |
| 59 | 59 | } |