Conditions | 4 |
Paths | 4 |
Total Lines | 21 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 4.0092 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
26 | 20 | protected function getDateOption(InputInterface $input, OutputInterface $output, string $key): ?Chronos |
|
27 | { |
||
28 | 20 | $value = $input->getOption($key); |
|
29 | 20 | if (empty($value)) { |
|
30 | 18 | return null; |
|
31 | } |
||
32 | |||
33 | try { |
||
34 | 5 | return Chronos::parse($value); |
|
|
|||
35 | 1 | } catch (Throwable $e) { |
|
36 | 1 | $output->writeln(sprintf( |
|
37 | '<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 |