Conditions | 5 |
Paths | 12 |
Total Lines | 26 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 16 |
CRAP Score | 5 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | 24 | public function validate(InputInterface $input): bool |
|
15 | { |
||
16 | 24 | $hasValidInput = true; |
|
17 | |||
18 | 24 | $sizes = (array) $input->getOption(BenchmarkCommand::SIZE_OPTION); |
|
19 | 24 | $iterations = $input->getOption(BenchmarkCommand::ITERATIONS_OPTION); |
|
20 | 24 | $seed = $input->getOption(BenchmarkCommand::SEED_OPTION); |
|
21 | |||
22 | 24 | foreach ($sizes as $size) { |
|
23 | 24 | if (!$this->isPositiveInteger($size)) { |
|
24 | 7 | $this->output->error('The size must be an integer greater than 0'); |
|
25 | 7 | $hasValidInput = false; |
|
26 | } |
||
27 | } |
||
28 | |||
29 | 24 | if (!$this->isPositiveInteger($iterations)) { |
|
30 | 8 | $this->output->error('The number of iterations must be an integer greater than 0'); |
|
31 | 8 | $hasValidInput = false; |
|
32 | } |
||
33 | |||
34 | 24 | if (!$this->isOptionalInteger($seed)) { |
|
35 | 8 | $this->output->error('The seed must be an integer'); |
|
36 | 8 | $hasValidInput = false; |
|
37 | } |
||
38 | |||
39 | 24 | return $hasValidInput; |
|
40 | } |
||
56 |