| @@ 96-115 (lines=20) @@ | ||
| 93 | * @param OutputInterface $output |
|
| 94 | * @param string $name |
|
| 95 | */ |
|
| 96 | protected function askAndValidateInteract(InputInterface $input, OutputInterface $output, $name) |
|
| 97 | { |
|
| 98 | $default = $input->getOption('default'); |
|
| 99 | ||
| 100 | if (!$input->getArgument($name) && !$default) { |
|
| 101 | $argument = $this->getHelper('dialog')->askAndValidate( |
|
| 102 | $output, |
|
| 103 | '<question>Please enter '.$name.':</question>', |
|
| 104 | function ($argument) use ($name) { |
|
| 105 | if (empty($argument)) { |
|
| 106 | throw new \RuntimeException('The '.$name.' can not be empty'); |
|
| 107 | } |
|
| 108 | ||
| 109 | return $argument; |
|
| 110 | } |
|
| 111 | ); |
|
| 112 | ||
| 113 | $input->setArgument($name, $argument); |
|
| 114 | } |
|
| 115 | } |
|
| 116 | ||
| 117 | /** |
|
| 118 | * @param string $name |
|
| @@ 119-137 (lines=19) @@ | ||
| 116 | * @param OutputInterface $output |
|
| 117 | * @param string $name |
|
| 118 | */ |
|
| 119 | protected function askAndValidateInteract(InputInterface $input, OutputInterface $output, $name) |
|
| 120 | { |
|
| 121 | $default = $input->getOption('default'); |
|
| 122 | if (!$input->getArgument($name) && !$default) { |
|
| 123 | $argument = $this->getHelper('dialog')->askAndValidate( |
|
| 124 | $output, |
|
| 125 | '<question>Please enter '.$name.':</question>', |
|
| 126 | function ($argument) use ($name) { |
|
| 127 | if (empty($argument)) { |
|
| 128 | throw new \RuntimeException('The '.$name.' can not be empty'); |
|
| 129 | } |
|
| 130 | ||
| 131 | return $argument; |
|
| 132 | } |
|
| 133 | ); |
|
| 134 | ||
| 135 | $input->setArgument($name, $argument); |
|
| 136 | } |
|
| 137 | } |
|
| 138 | ||
| 139 | /** |
|
| 140 | * Creates a new tenant. |
|