SagaEventListenerMapCodeGenerator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 5
dl 0
loc 18
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A discover() 0 8 1
A log() 0 4 1
1
<?php
2
/******************************************************************************
3
 * Copyright (c) 2017 Constantin Galbenu <[email protected]>             *
4
 ******************************************************************************/
5
6
namespace Gica\Cqrs\CodeGeneration;
7
8
9
use Gica\CodeAnalysis\MethodListenerDiscovery;
10
use Gica\CodeAnalysis\MethodListenerDiscovery\ListenerClassValidator\AnyPhpClassIsAccepted;
11
use Gica\Cqrs\CodeGeneration\Traits\GroupedByEventTrait;
12
use Gica\Cqrs\Command\CodeAnalysis\WriteSideEventHandlerDetector;
13
14
class SagaEventListenerMapCodeGenerator
15
{
16
    use GroupedByEventTrait;
17
18 1
    protected function discover(\Iterator $files)
19
    {
20 1
        $discoverer = new MethodListenerDiscovery(
21 1
            new WriteSideEventHandlerDetector(),
22 1
            new AnyPhpClassIsAccepted);
23
24 1
        return $discoverer->discoverListeners($files);
25
    }
26
27 1
    protected function log($outputFilePath)
28
    {
29 1
        $this->logger->info("Command side (saga) events handlers map wrote to: $outputFilePath");
30
    }
31
}