AggregateEventApplyHandlerValidator   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 28
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A validate() 0 13 2
1
<?php
2
/******************************************************************************
3
 * Copyright (c) 2017 Constantin Galbenu <[email protected]>             *
4
 ******************************************************************************/
5
6
namespace Gica\Cqrs\CodeGeneration;
7
8
use Gica\CodeAnalysis\AggregateEventHandlersValidator;
9
use Gica\Cqrs\Aggregate\CodeAnalysis\ListenerClassValidator\OnlyAggregateByName;
10
use Psr\Log\LoggerInterface;
11
12
class AggregateEventApplyHandlerValidator
13
{
14
    /**
15
     * @var LoggerInterface
16
     */
17
    private $logger;
18
19 1
    public function __construct(
20
        LoggerInterface $logger = null
21
    )
22
    {
23 1
        $this->logger = $logger;
24 1
    }
25
26 1
    public function validate(
27
        \Iterator $files
28
    )
29
    {
30 1
        $validator = new AggregateEventHandlersValidator(
31 1
            new OnlyAggregateByName());
32
33 1
        $validator->validateEventHandlers($files);
34
35 1
        if ($this->logger) {
36 1
            $this->logger->info("Aggregate event handlers are valid");
37
        }
38
    }
39
}