You are here

public function InputDefinition::setDefinition in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/console/Input/InputDefinition.php \Symfony\Component\Console\Input\InputDefinition::setDefinition()

Sets the definition of the input.

Parameters

array $definition The definition array:

1 call to InputDefinition::setDefinition()
InputDefinition::__construct in vendor/symfony/console/Input/InputDefinition.php
Constructor.

File

vendor/symfony/console/Input/InputDefinition.php, line 54

Class

InputDefinition
A InputDefinition represents a set of valid command line arguments and options.

Namespace

Symfony\Component\Console\Input

Code

public function setDefinition(array $definition) {
  $arguments = array();
  $options = array();
  foreach ($definition as $item) {
    if ($item instanceof InputOption) {
      $options[] = $item;
    }
    else {
      $arguments[] = $item;
    }
  }
  $this
    ->setArguments($arguments);
  $this
    ->setOptions($options);
}