Completed
Push — master ( e1cfbf...f5d5d5 )
by Joachim
04:22
created

PaymentRepository   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 1
dl 0
loc 24
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A findByOrderIdOrAltapayId() 0 16 2
1
<?php
2
3
namespace Loevgaard\DandomainAltapayBundle\Entity;
4
5
class PaymentRepository extends EntityRepository
6
{
7
    /**
8
     * @param $id
9
     *
10
     * @return null|Payment
11
     */
12
    public function findByOrderIdOrAltapayId($id) : ?Payment
13
    {
14
        /** @var Payment $payment */
15
        $payment = $this->findOneBy([
16
            'orderId' => $id,
17
        ]);
18
19
        if (!$payment) {
20
            /** @var Payment $payment */
21
            $payment = $this->findOneBy([
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $payment is correct as $this->findOneBy(array('altapayId' => $id)) (which targets Loevgaard\DandomainAltap...Repository::findOneBy()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
22
                'altapayId' => $id,
23
            ]);
24
        }
25
26
        return $payment;
27
    }
28
}
29