| Total Complexity | 7 |
| Total Lines | 52 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 12 | class TraefikPasswordOptionProvider implements OptionProvider |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var Style |
||
| 16 | */ |
||
| 17 | private $style; |
||
| 18 | |||
| 19 | public function __construct(Style $style) |
||
| 20 | { |
||
| 21 | $this->style = $style; |
||
| 22 | } |
||
| 23 | |||
| 24 | public function option(EnvironmentState $environmentState): InputOption |
||
| 25 | { |
||
| 26 | return new StyledInputOption( |
||
| 27 | $this->optionName(), |
||
| 28 | null, |
||
| 29 | InputOption::VALUE_REQUIRED, |
||
| 30 | $this->helpMessage(), |
||
| 31 | $environmentState->defaultValue(TraefikPassword::TRAEFIK_UI_PASSWORD) |
||
| 32 | ); |
||
| 33 | } |
||
| 34 | |||
| 35 | public function validate(string $value) |
||
| 36 | { |
||
| 37 | TraefikPassword::fromString($value); |
||
| 38 | } |
||
| 39 | |||
| 40 | public function helpMessage(): string |
||
| 46 | ] |
||
| 47 | ); |
||
| 48 | } |
||
| 49 | |||
| 50 | public function optionName(): string |
||
| 51 | { |
||
| 52 | return TraefikPassword::OPTION_NAME; |
||
| 53 | } |
||
| 54 | |||
| 55 | public function question(): Question |
||
| 56 | { |
||
| 57 | return new Question( |
||
| 58 | $this->style->quittableQuestion("Choose a <options=bold>password for your Traefik UI</>") |
||
| 59 | ); |
||
| 60 | } |
||
| 61 | |||
| 62 | public function onCorrectAnswer(string $answer) |
||
| 64 | // do nothing |
||
| 65 | } |
||
| 66 | |||
| 67 | } |