Passed
Push — main ( 7dcca1...e70bce )
by Daniel
04:22
created

Bootstrapper   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 7
dl 0
loc 20
ccs 8
cts 8
cp 1
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Uxmp\Core\Component\Setup;
6
7
use Ahc\Cli\IO\Interactor;
8
use Uxmp\Core\Component\Setup\Validator\Exception\ValidationException;
9
10
final readonly class Bootstrapper implements BootstrapperInterface
0 ignored issues
show
Bug introduced by
A parse error occurred: Syntax error, unexpected T_READONLY, expecting T_CLASS on line 10 at column 6
Loading history...
11
{
12
    /**
13
     * @param array<Validator\ValidatorInterface> $validators
14
     */
15 2
    public function __construct(
16
        private array $validators
17
    ) {
18 2
    }
19
20 2
    public function bootstrap(
21
        Interactor $io
22
    ): void {
23 2
        foreach ($this->validators as $validator) {
24
            try {
25 2
                $validator->validate();
26 1
            } catch (ValidationException $validationException) {
27 1
                $io->error($validationException->getMessage(), true);
28
29 1
                break;
30
            }
31
        }
32
    }
33
}
34