@@ -18,29 +18,29 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | public function __invoke(ConsoleContainer $container, $ann) |
| 20 | 20 | { |
| 21 | - if(!$ann->parent || !$ann->parent->parent){ |
|
| 21 | + if (!$ann->parent || !$ann->parent->parent) { |
|
| 22 | 22 | Logger::debug("The annotation \"@{$ann->name} {$ann->description}\" of {$container->getClassName()} should be used with parent parent"); |
| 23 | 23 | return; |
| 24 | 24 | } |
| 25 | 25 | $target = $ann->parent->parent->name; |
| 26 | 26 | $command = $container->getCommand($target); |
| 27 | - if(!$command){ |
|
| 27 | + if (!$command) { |
|
| 28 | 28 | Logger::debug("The annotation \"@{$ann->name} {$ann->description}\" of {$container->getClassName()}::$target should be used with parent parent"); |
| 29 | - return ; |
|
| 29 | + return; |
|
| 30 | 30 | } |
| 31 | 31 | $params = new AnnotationParams($ann->description, 2); |
| 32 | 32 | |
| 33 | 33 | count($params)>0 or \PhpBoot\abort(new AnnotationSyntaxException("The annotation \"@{$ann->name} {$ann->description}\" of {$container->getClassName()}::$target require 1 param, {$params->count()} given")); |
| 34 | 34 | |
| 35 | - if($ann->parent->name == 'param'){ |
|
| 35 | + if ($ann->parent->name == 'param') { |
|
| 36 | 36 | list($paramType, $paramName, $paramDoc) = ParamAnnotationHandler::getParamInfo($ann->parent->description); |
| 37 | 37 | |
| 38 | 38 | $paramMeta = $command->getParamMeta($paramName); |
| 39 | - if($params->count()>1){ |
|
| 39 | + if ($params->count()>1) { |
|
| 40 | 40 | $paramMeta->validation = [$params[0], $params[1]]; |
| 41 | - }else{ |
|
| 41 | + }else { |
|
| 42 | 42 | $paramMeta->validation = $params[0]; |
| 43 | - if($paramMeta->validation) { |
|
| 43 | + if ($paramMeta->validation) { |
|
| 44 | 44 | $v = new Validator(); |
| 45 | 45 | $v->rule($paramMeta->validation, $paramMeta->name); |
| 46 | 46 | if ($v->hasRule('optional', $paramMeta->name)) { |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | $paramMeta = $command->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(); |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | public function getCommand($target) |
| 60 | 60 | { |
| 61 | - return isset($this->commands[$target])?$this->commands[$target]:null; |
|
| 61 | + return isset($this->commands[$target]) ? $this->commands[$target] : null; |
|
| 62 | 62 | } |
| 63 | 63 | /** |
| 64 | 64 | * @return string |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | public function postCreate() |
| 99 | 99 | { |
| 100 | - foreach ($this->commands as $command){ |
|
| 100 | + foreach ($this->commands as $command) { |
|
| 101 | 101 | $command->postCreate($this); |
| 102 | 102 | } |
| 103 | 103 | } |
@@ -113,8 +113,8 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | public function getInstance(FactoryInterface $factory) |
| 115 | 115 | { |
| 116 | - if(!$this->instance ){ |
|
| 117 | - $this->instance = $factory->make($this->getClassName()); |
|
| 116 | + if (!$this->instance) { |
|
| 117 | + $this->instance = $factory->make($this->getClassName()); |
|
| 118 | 118 | } |
| 119 | 119 | return $this->instance; |
| 120 | 120 | } |