[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/symfony/console/Completion/ -> CompletionSuggestions.php (source)

   1  <?php
   2  
   3  /*
   4   * This file is part of the Symfony package.
   5   *
   6   * (c) Fabien Potencier <[email protected]>
   7   *
   8   * For the full copyright and license information, please view the LICENSE
   9   * file that was distributed with this source code.
  10   */
  11  
  12  namespace Symfony\Component\Console\Completion;
  13  
  14  use Symfony\Component\Console\Input\InputOption;
  15  
  16  /**
  17   * Stores all completion suggestions for the current input.
  18   *
  19   * @author Wouter de Jong <[email protected]>
  20   */
  21  final class CompletionSuggestions
  22  {
  23      private $valueSuggestions = [];
  24      private $optionSuggestions = [];
  25  
  26      /**
  27       * Add a suggested value for an input option or argument.
  28       *
  29       * @param string|Suggestion $value
  30       *
  31       * @return $this
  32       */
  33      public function suggestValue($value): self
  34      {
  35          $this->valueSuggestions[] = !$value instanceof Suggestion ? new Suggestion($value) : $value;
  36  
  37          return $this;
  38      }
  39  
  40      /**
  41       * Add multiple suggested values at once for an input option or argument.
  42       *
  43       * @param list<string|Suggestion> $values
  44       *
  45       * @return $this
  46       */
  47      public function suggestValues(array $values): self
  48      {
  49          foreach ($values as $value) {
  50              $this->suggestValue($value);
  51          }
  52  
  53          return $this;
  54      }
  55  
  56      /**
  57       * Add a suggestion for an input option name.
  58       *
  59       * @return $this
  60       */
  61      public function suggestOption(InputOption $option): self
  62      {
  63          $this->optionSuggestions[] = $option;
  64  
  65          return $this;
  66      }
  67  
  68      /**
  69       * Add multiple suggestions for input option names at once.
  70       *
  71       * @param InputOption[] $options
  72       *
  73       * @return $this
  74       */
  75      public function suggestOptions(array $options): self
  76      {
  77          foreach ($options as $option) {
  78              $this->suggestOption($option);
  79          }
  80  
  81          return $this;
  82      }
  83  
  84      /**
  85       * @return InputOption[]
  86       */
  87      public function getOptionSuggestions(): array
  88      {
  89          return $this->optionSuggestions;
  90      }
  91  
  92      /**
  93       * @return Suggestion[]
  94       */
  95      public function getValueSuggestions(): array
  96      {
  97          return $this->valueSuggestions;
  98      }
  99  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer