Completed
Pull Request — master (#384)
by Kristof
03:59
created

handle()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9

Duplication

Lines 9
Ratio 100 %

Importance

Changes 0
Metric Value
dl 9
loc 9
rs 9.9666
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
namespace CultuurNet\UDB3\EventHandling;
4
5
use Broadway\Domain\DomainMessage;
6
use CultuurNet\UDB3\DomainMessageAdapter;
7
8
trait DelegateEventHandlingToSpecificMethodTraitWithDomainMessageAdapter
9
{
10
    use DelegateEventHandlingToSpecificMethodTrait;
11
12
    /**
13
     * {@inheritDoc}
14
     */
15 View Code Duplication
    public function handle(DomainMessage $domainMessage)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
16
    {
17
        $event  = $domainMessage->getPayload();
18
        $method = $this->getHandleMethodName($event);
19
20
        if ($method) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $method of type null|string is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
21
            $this->$method($event, new DomainMessageAdapter($domainMessage));
22
        }
23
    }
24
}
25