Code Duplication    Length = 12-12 lines in 3 locations

src/Gica/Cqrs/Command/CodeAnalysis/ReadModelEventHandlerDetector.php 1 location

@@ 13-24 (lines=12) @@
10
use Gica\CodeAnalysis\Shared\ClassComparison\SubclassComparator;
11
use Gica\Cqrs\Event;
12
13
class ReadModelEventHandlerDetector implements MessageClassDetector
14
{
15
    public function isMessageClass(\ReflectionClass $typeHintedClass): bool
16
    {
17
        return (new SubclassComparator())->isASubClassButNoSameClass($typeHintedClass->name, Event::class);
18
    }
19
20
    public function isMethodAccepted(\ReflectionMethod $reflectionMethod): bool
21
    {
22
        return 0 === stripos($reflectionMethod->name, 'on');
23
    }
24
}

src/Gica/Cqrs/Command/CodeAnalysis/WriteSideEventHandlerDetector.php 1 location

@@ 13-24 (lines=12) @@
10
use Gica\CodeAnalysis\Shared\ClassComparison\SubclassComparator;
11
use Gica\Cqrs\Event;
12
13
class WriteSideEventHandlerDetector implements MessageClassDetector
14
{
15
    public function isMessageClass(\ReflectionClass $typeHintedClass):bool
16
    {
17
        return (new SubclassComparator())->isASubClassButNoSameClass($typeHintedClass->name, Event::class);
18
    }
19
20
    public function isMethodAccepted(\ReflectionMethod $reflectionMethod):bool
21
    {
22
        return 0 === stripos($reflectionMethod->name, 'process');
23
    }
24
}

src/Gica/Cqrs/Event/CodeAnalysis/EventClassDetector.php 1 location

@@ 13-24 (lines=12) @@
10
use Gica\CodeAnalysis\Shared\ClassComparison\SubclassComparator;
11
use Gica\Cqrs\Event;
12
13
class EventClassDetector implements MessageClassDetector
14
{
15
    public function isMessageClass(\ReflectionClass $typeHintedClass):bool
16
    {
17
        return (new SubclassComparator())->isASubClassButNoSameClass($typeHintedClass->name, Event::class);
18
    }
19
20
    public function isMethodAccepted(\ReflectionMethod $reflectionMethod):bool
21
    {
22
        return true;
23
    }
24
}