comparison vendor/symfony/console/Input/Input.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 4c8ae668cc8c
children 129ea1e6d783
comparison
equal deleted inserted replaced
13:5fb285c0d0e3 14:1fec387a4317
25 * 25 *
26 * @author Fabien Potencier <fabien@symfony.com> 26 * @author Fabien Potencier <fabien@symfony.com>
27 */ 27 */
28 abstract class Input implements InputInterface, StreamableInputInterface 28 abstract class Input implements InputInterface, StreamableInputInterface
29 { 29 {
30 /**
31 * @var InputDefinition
32 */
33 protected $definition; 30 protected $definition;
34 protected $stream; 31 protected $stream;
35 protected $options = array(); 32 protected $options = array();
36 protected $arguments = array(); 33 protected $arguments = array();
37 protected $interactive = true; 34 protected $interactive = true;
38 35
39 /**
40 * Constructor.
41 *
42 * @param InputDefinition|null $definition A InputDefinition instance
43 */
44 public function __construct(InputDefinition $definition = null) 36 public function __construct(InputDefinition $definition = null)
45 { 37 {
46 if (null === $definition) { 38 if (null === $definition) {
47 $this->definition = new InputDefinition(); 39 $this->definition = new InputDefinition();
48 } else { 40 } else {
156 { 148 {
157 if (!$this->definition->hasOption($name)) { 149 if (!$this->definition->hasOption($name)) {
158 throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name)); 150 throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
159 } 151 }
160 152
161 return isset($this->options[$name]) ? $this->options[$name] : $this->definition->getOption($name)->getDefault(); 153 return array_key_exists($name, $this->options) ? $this->options[$name] : $this->definition->getOption($name)->getDefault();
162 } 154 }
163 155
164 /** 156 /**
165 * {@inheritdoc} 157 * {@inheritdoc}
166 */ 158 */