SagaEventListenerMapCodeGenerator::discover()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 1
crap 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
}