You are here

public function InputArgument::__construct in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/console/Input/InputArgument.php \Symfony\Component\Console\Input\InputArgument::__construct()

Constructor.

Parameters

string $name The argument name:

int $mode The argument mode: self::REQUIRED or self::OPTIONAL:

string $description A description text:

mixed $default The default value (for self::OPTIONAL mode only):

Throws

\InvalidArgumentException When argument mode is not valid

File

vendor/symfony/console/Input/InputArgument.php, line 40

Class

InputArgument
Represents a command line argument.

Namespace

Symfony\Component\Console\Input

Code

public function __construct($name, $mode = null, $description = '', $default = null) {
  if (null === $mode) {
    $mode = self::OPTIONAL;
  }
  elseif (!is_int($mode) || $mode > 7 || $mode < 1) {
    throw new \InvalidArgumentException(sprintf('Argument mode "%s" is not valid.', $mode));
  }
  $this->name = $name;
  $this->mode = $mode;
  $this->description = $description;
  $this
    ->setDefault($default);
}