CustomerProxy   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
eloc 2
dl 0
loc 8
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __load() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace LauLamanApps\eCurring\Resource\Proxy;
6
7
use DateTimeImmutable;
8
use LauLamanApps\eCurring\eCurringClientInterface;
9
use LauLamanApps\eCurring\Resource\Customer;
10
use LauLamanApps\eCurring\Resource\Customer\Gender;
11
use LauLamanApps\eCurring\Resource\Customer\VerificationMethod;
12
use LauLamanApps\eCurring\Resource\CustomerInterface;
13
use LauLamanApps\eCurring\Resource\Transaction\PaymentMethod;
14
15
/**
16
 * @method int getId()
17
 * @method Gender getGender()
18
 * @method string getFirstName()
19
 * @method string|null getMiddleName()
20
 * @method string getLastName()
21
 * @method string getCompanyName()
22
 * @method string getVatNumber()
23
 * @method PaymentMethod getPaymentType()
24
 * @method VerificationMethod|null getBankVerificationMethod()
25
 * @method string getCardHolder()
26
 * @method string getCardNumber()
27
 * @method string getPostalcode()
28
 * @method string getHouseNumber()
29
 * @method string|null getHouseNumberAdd()
30
 * @method string getStreet()
31
 * @method string getCity()
32
 * @method string getCountryCode()
33
 * @method string getLanguage()
34
 * @method string getEmail()
35
 * @method string getTelephone()
36
 * @method array getSubscriptions()
37
 * @method DateTimeImmutable getCreatedAt()
38
 * @method DateTimeImmutable getUpdatedAt()
39
 */
40
final class CustomerProxy extends AbstractProxy implements CustomerInterface
41
{
42
    /**
43
     * @return Customer
44
     */
45
    protected function __load(eCurringClientInterface $client, string $id)
46
    {
47
        return $client->getCustomer($id);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $client->getCustomer($id) returns the type LauLamanApps\eCurring\Resource\Customer which is incompatible with the return type mandated by LauLamanApps\eCurring\Re...AbstractProxy::__load() of LauLamanApps\eCurring\Resource\Subscription.

In the issue above, the returned value is violating the contract defined by the mentioned interface.

Let's take a look at an example:

interface HasName {
    /** @return string */
    public function getName();
}

class Name {
    public $name;
}

class User implements HasName {
    /** @return string|Name */
    public function getName() {
        return new Name('foo'); // This is a violation of the ``HasName`` interface
                                // which only allows a string value to be returned.
    }
}
Loading history...
48
    }
49
}
50