Passed
Push — main ( 764702...024f60 )
by Daniel
04:19
created

Bootstrapper::bootstrap()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 10
ccs 0
cts 7
cp 0
rs 10
cc 3
nc 3
nop 1
crap 12
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Uxmp\Core\Component\Setup;
6
7
use Ahc\Cli\IO\Interactor;
8
9
final class Bootstrapper implements BootstrapperInterface
10
{
11
    /**
12
     * @param array<Validator\ValidatorInterface> $validators
13
     */
14
    public function __construct(
15
        private array $validators
16
    ) {
17
    }
18
19
    public function bootstrap(
20
        Interactor $io
21
    ): void {
22
        foreach ($this->validators as $validator) {
23
            try {
24
                $validator->validate();
25
            } catch (Validator\Exception\ValidationException $e) {
26
                $io->error($e->getMessage(), true);
27
28
                break;
29
            }
30
        }
31
    }
32
}
33