@@ -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 @@ discard block |
||
38 | 38 | $container = $this->consoleContainerBuilder->build($className); |
39 | 39 | /**@var ConsoleContainer $container*/ |
40 | 40 | foreach ($container->getCommands() as $name => $command) { |
41 | - $command->setCode(function (InputInterface $input, OutputInterface $output)use ($container, $command){ |
|
41 | + $command->setCode(function(InputInterface $input, OutputInterface $output)use ($container, $command){ |
|
42 | 42 | return $command->invoke($container, $input, $output); |
43 | 43 | }); |
44 | 44 | $this->add($command); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | { |
55 | 55 | $dir = @dir($fromPath) or abort("dir $fromPath not exist"); |
56 | 56 | |
57 | - $getEach = function () use ($dir) { |
|
57 | + $getEach = function() use ($dir) { |
|
58 | 58 | $name = $dir->read(); |
59 | 59 | if (!$name) { |
60 | 60 | return $name; |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | if ($entry == '.' || $entry == '..') { |
67 | 67 | continue; |
68 | 68 | } |
69 | - $path = $fromPath . '/' . str_replace('\\', '/', $entry); |
|
69 | + $path = $fromPath.'/'.str_replace('\\', '/', $entry); |
|
70 | 70 | if (is_file($path) && substr_compare($entry, '.php', strlen($entry) - 4, 4, true) == 0) { |
71 | - $class_name = $namespace . '\\' . substr($entry, 0, strlen($entry) - 4); |
|
71 | + $class_name = $namespace.'\\'.substr($entry, 0, strlen($entry) - 4); |
|
72 | 72 | $this->loadCommandsFromClass($class_name); |
73 | - } else { |
|
73 | + }else { |
|
74 | 74 | //\Log::debug($path.' ignored'); |
75 | 75 | } |
76 | 76 | } |