| Conditions | 4 |
| Paths | 4 |
| Total Lines | 21 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 4.0072 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 26 | 19 | protected function getDateOption(InputInterface $input, OutputInterface $output, string $key): ?Chronos |
|
| 27 | { |
||
| 28 | 19 | $value = $input->getOption($key); |
|
| 29 | 19 | if (empty($value)) { |
|
| 30 | 17 | return null; |
|
| 31 | } |
||
| 32 | |||
| 33 | try { |
||
| 34 | 5 | return Chronos::parse($value); |
|
|
|
|||
| 35 | 1 | } catch (Throwable $e) { |
|
| 36 | 1 | $output->writeln(sprintf( |
|
| 37 | 1 | '<comment>> Ignored provided "%s" since its value "%s" is not a valid date. <</comment>', |
|
| 38 | 1 | $key, |
|
| 39 | 1 | $value |
|
| 40 | )); |
||
| 41 | |||
| 42 | 1 | if ($output->isVeryVerbose()) { |
|
| 43 | $this->getApplication()->renderThrowable($e, $output); |
||
| 44 | } |
||
| 45 | |||
| 46 | 1 | return null; |
|
| 47 | } |
||
| 55 |