Stecman\Component\Symfony\Console\BashCompletion\CompletionHandler::runCompletion PHP Метод

runCompletion() публичный Метод

Do the actual completion, returning an array of strings to provide to the parent shell's completion system
public runCompletion ( ) : string[]
Результат string[]
    public function runCompletion()
    {
        if (!$this->context) {
            throw new \RuntimeException('A CompletionContext must be set before requesting completion.');
        }
        $cmdName = $this->getInput()->getFirstArgument();
        try {
            $this->command = $this->application->find($cmdName);
        } catch (\InvalidArgumentException $e) {
            // Exception thrown, when multiple or none commands are found.
        }
        $process = array('completeForOptionValues', 'completeForOptionShortcuts', 'completeForOptionShortcutValues', 'completeForOptions', 'completeForCommandName', 'completeForCommandArguments');
        foreach ($process as $methodName) {
            $result = $this->{$methodName}();
            if (false !== $result) {
                // Return the result of the first completion mode that matches
                return $this->filterResults((array) $result);
            }
        }
        return array();
    }

Usage Example

Пример #1
0
 /**
  * Run the completion handler and return a filtered list of results
  *
  * @deprecated - This will be removed in 1.0.0 in favour of CompletionCommand::configureCompletion
  *
  * @return string[]
  */
 protected function runCompletion()
 {
     $this->configureCompletion($this->handler);
     return $this->handler->runCompletion();
 }