protected function _createFromActionableMethod(\ReflectionClass $class)
  {
    if($class->hasMethod('executeCommand'))
    {
      $methodName = 'executeCommand';
    }
    else if($class->hasMethod('process'))
    {
      $methodName = 'process';
    }
    else
    {
      return null;
    }

    $method = $class->getMethod($methodName);

    $addedArguments = false;

    $propBlock = new DocBlockParser($method->getDocComment());
    $descriptions = [];
    foreach($propBlock->getTags() as $name => $description)
    {
      $tagName = $name;
      $descriptions[$tagName] = $description;
    }

    foreach($method->getParameters() as $paramNum => $parameter)
    {
      //Skip over the input and output args for executeCommand
      if($paramNum < 2 && $methodName == 'executeCommand')
      {
        continue;
      }
      $mode = InputArgument::REQUIRED;
      $default = null;
      if($parameter->isDefaultValueAvailable())
      {
        $mode = InputArgument::OPTIONAL;
        $default = $parameter->getDefaultValue();
      }

      $this->addArgument(
        $parameter->name,
        $parameter->isArray() ? $mode | InputArgument::IS_ARRAY : $mode,
        isset($descriptions[$parameter->name]) ? $descriptions[$parameter->name] : '',
        $default
      );

      $addedArguments = true;
    }

    return $addedArguments;
  }
protected function _createFromActionableMethod(\ReflectionClass $class)
  {
    if($class->hasMethod('executeCommand'))
    {
      $methodName = 'executeCommand';
    }
    else if($class->hasMethod('process'))
    {
      $methodName = 'process';
    }
    else
    {
      return null;
    }

    $method = $class->getMethod($methodName);

    $addedArguments = false;

    $propBlock = new DocBlockParser($method->getDocComment());
    $descriptions = [];
    foreach($propBlock->getTags() as $name => $description)
    {
      $tagName = $name;
      $descriptions[$tagName] = $description;
    }

    foreach($method->getParameters() as $paramNum => $parameter)
    {
      //Skip over the input and output args for executeCommand
      if($paramNum < 2 && $methodName == 'executeCommand')
      {
        continue;
      }
      $mode = InputArgument::REQUIRED;
      $default = null;
      if($parameter->isDefaultValueAvailable())
      {
        $mode = InputArgument::OPTIONAL;
        $default = $parameter->getDefaultValue();
      }

      $this->addArgument(
        $parameter->name,
        $parameter->isArray() ? $mode | InputArgument::IS_ARRAY : $mode,
        isset($descriptions[$parameter->name]) ? $descriptions[$parameter->name] : '',
        $default
      );

      $addedArguments = true;
    }

    return $addedArguments;
  }
protected function _createFromActionableMethod ( \ ReflectionClass $ class ) { if ( $ class -> hasMethod ( 'executeCommand' ) ) { $ methodName = 'executeCommand' ; } else if ( $ class -> hasMethod ( 'process' ) ) { $ methodName = 'process' ; } else { return null ; } $ method = $ class -> getMethod ( $ methodName ) ; $ addedArguments = false ; $ propBlock = new DocBlockParser ( $ method -> getDocComment ( ) ) ; $ descriptions = [ ] ; foreach ( $ propBlock -> getTags ( ) as $ name => $ description ) { $ tagName = $ name ; $ descriptions [ $ tagName ] = $ description ; } foreach ( $ method -> getParameters ( ) as $ paramNum => $ parameter ) { //Skip over the input and output args for executeCommand if ( $ paramNum < 2 && $ methodName == 'executeCommand' ) { continue ; } $ mode = InputArgument :: REQUIRED ; $ default = null ; if ( $ parameter -> isDefaultValueAvailable ( ) ) { $ mode = InputArgument :: OPTIONAL ; $ default = $ parameter -> getDefaultValue ( ) ; } $ this -> addArgument ( $ parameter -> name , $ parameter -> isArray ( ) ? $ mode | InputArgument :: IS_ARRAY : $ mode , isset ( $ descriptions [ $ parameter -> name ] ) ? $ descriptions [ $ parameter -> name ] : '' , $ default ) ; $ addedArguments = true ; } return $ addedArguments ; }
Create arguments from your executeCommand method parameters

@param \ReflectionClass $class

@return bool|null
@throws \ReflectionException
Create arguments from your executeCommand method parameters