Webmozart\Console\Api\Args\Args::getRawArgs PHP Méthode

getRawArgs() public méthode

Returns the raw console arguments.
public getRawArgs ( ) : Webmozart\Console\Api\Args\RawArgs
Résultat Webmozart\Console\Api\Args\RawArgs The raw arguments.
    public function getRawArgs()
    {
        return $this->rawArgs;
    }

Usage Example

Exemple #1
0
 /**
  * Callback for selecting the handler that should be run.
  *
  * @param Args    $args    The console arguments.
  * @param IO      $io      The I/O.
  * @param Command $command The handled command.
  *
  * @return string The name of the handler to run.
  */
 public function getHandlerToRun(Args $args, IO $io, Command $command)
 {
     $rawArgs = $args->getRawArgs();
     // The raw arguments should always be available, but check anyway
     if (!$rawArgs) {
         return 'text';
     }
     // If "-h" is given, always print the short text usage
     if ($rawArgs->hasToken('-h')) {
         return 'text';
     }
     // Check if any of the options is set
     foreach ($this->getRegisteredNames() as $handlerName) {
         if ($rawArgs->hasToken('--' . $handlerName)) {
             return $handlerName;
         }
     }
     // No format option is set, "-h" is not set
     // If a command is given or if "--help" is set, display the manual
     if ($rawArgs->hasToken('--help')) {
         // Return "man" if the binary is available and the man page exists
         // The process launcher must be supported on the system
         $manPage = $this->getManPage($command->getApplication(), $args);
         if (file_exists($manPage) && $this->processLauncher->isSupported()) {
             if (!$this->manBinary) {
                 $this->manBinary = $this->executableFinder->find('man');
             }
             if ($this->manBinary) {
                 return 'man';
             }
         }
         // Return "ascii-doc" if the AsciiDoc page exists
         $asciiDocPage = $this->getAsciiDocPage($command->getApplication(), $args);
         if (file_exists($asciiDocPage)) {
             return 'ascii-doc';
         }
     }
     // No command, no option -> display command list as text
     return 'text';
 }
All Usage Examples Of Webmozart\Console\Api\Args\Args::getRawArgs