Completed
Pull Request — master (#25)
by Andrey
11:08 queued 03:02
created

AmazonPayStub::confirmPurchase()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Apache OSL-2
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Client\AmazonPay\Zed;
9
10
use Generated\Shared\Transfer\QuoteTransfer;
1 ignored issue
show
Bug introduced by
The type Generated\Shared\Transfer\QuoteTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Spryker\Client\ZedRequest\ZedRequestClientInterface;
12
13
class AmazonPayStub implements AmazonPayStubInterface
14
{
15
    /**
16
     * @var \Spryker\Client\ZedRequest\ZedRequestClientInterface
17
     */
18
    protected $zedStub;
19
20
    /**
21
     * @param \Spryker\Client\ZedRequest\ZedRequestClientInterface $zedStub
22
     */
23
    public function __construct(ZedRequestClientInterface $zedStub)
24
    {
25
        $this->zedStub = $zedStub;
26
    }
27
28
    /**
29
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
30
     *
31
     * @return \Spryker\Shared\Kernel\Transfer\TransferInterface
32
     */
33
    public function handleCartWithAmazonPay(QuoteTransfer $quoteTransfer)
34
    {
35
        return $this->zedStub->call('/amazon-pay/gateway/handle-cart-with-amazon-pay', $quoteTransfer);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->zedStub->c...n-pay', $quoteTransfer) returns the type Spryker\Shared\Kernel\Transfer\TransferInterface which is incompatible with the return type mandated by SprykerEco\Client\Amazon...ndleCartWithAmazonPay() of Generated\Shared\Transfer\QuoteTransfer.

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...
36
    }
37
38
    /**
39
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
40
     *
41
     * @return \Spryker\Shared\Kernel\Transfer\TransferInterface
42
     */
43
    public function addSelectedAddressToQuote(QuoteTransfer $quoteTransfer)
44
    {
45
        return $this->zedStub->call(
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->zedStub->c...quote', $quoteTransfer) returns the type Spryker\Shared\Kernel\Transfer\TransferInterface which is incompatible with the return type mandated by SprykerEco\Client\Amazon...electedAddressToQuote() of Generated\Shared\Transfer\QuoteTransfer.

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...
46
            '/amazon-pay/gateway/add-selected-address-to-quote',
47
            $quoteTransfer
48
        );
49
    }
50
51
    /**
52
     * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
53
     *
54
     * @return \Spryker\Shared\Kernel\Transfer\TransferInterface
55
     */
56
    public function addSelectedShipmentMethodToQuote(QuoteTransfer $quoteTransfer)
57
    {
58
        return $this->zedStub->call(
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->zedStub->c...quote', $quoteTransfer) returns the type Spryker\Shared\Kernel\Transfer\TransferInterface which is incompatible with the return type mandated by SprykerEco\Client\Amazon...ShipmentMethodToQuote() of Generated\Shared\Transfer\QuoteTransfer.

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...
59
            '/amazon-pay/gateway/add-selected-shipment-method-to-quote',
60
            $quoteTransfer
61
        );
62
    }
63
}
64