示例#1
0
 public function render_argument_completion_values(ArgInfo $a)
 {
     if ($a->validValues || $a->suggestions) {
         $values = array();
         if ($a->validValues) {
             $values = $a->getValidValues();
         } elseif ($a->suggestions) {
             $values = $a->getSuggestions();
         }
         return join(" ", $values);
     }
     return '';
 }
示例#2
0
 /**
  * The default behaviour: get argument info from method parameters
  */
 public function getArgInfoListByReflection()
 {
     $argInfo = new ArgInfoList();
     $ro = new ReflectionObject($this);
     if (!method_exists($this, 'execute')) {
         throw new ExecuteMethodNotDefinedException($this);
     }
     $method = $ro->getMethod('execute');
     $requiredNumber = $method->getNumberOfRequiredParameters();
     $parameters = $method->getParameters();
     foreach ($parameters as $param) {
         // TODO: add description to the argument
         $a = new ArgInfo($param->getName());
         if ($param->isOptional()) {
             $a->optional(true);
         }
         $argInfo->append($a);
     }
     return $argInfo;
 }