Confirm::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 4
rs 10
1
<?php
2
3
/**
4
 * MIT License
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Zed\Ratepay\Business\Api\Model\Deliver;
9
10
use SprykerEco\Zed\Ratepay\Business\Api\Builder\HeadInterface;
11
use SprykerEco\Zed\Ratepay\Business\Api\Builder\ShoppingBasketInterface;
12
use SprykerEco\Zed\Ratepay\Business\Api\Constants;
13
use SprykerEco\Zed\Ratepay\Business\Api\Model\Base;
14
15
class Confirm extends Base
16
{
17
    /**
18
     * Deliver confirmation operation.
19
     */
20
    public const OPERATION = Constants::REQUEST_MODEL_DELIVER_CONFIRM;
21
22
    /**
23
     * @var \SprykerEco\Zed\Ratepay\Business\Api\Builder\ShoppingBasketInterface
24
     */
25
    protected $basket;
26
27
    /**
28
     * @param \SprykerEco\Zed\Ratepay\Business\Api\Builder\HeadInterface $head
29
     * @param \SprykerEco\Zed\Ratepay\Business\Api\Builder\ShoppingBasketInterface $shoppingBasket
30
     */
31
    public function __construct(HeadInterface $head, ShoppingBasketInterface $shoppingBasket)
32
    {
33
        parent::__construct($head);
34
        $this->basket = $shoppingBasket;
35
    }
36
37
    /**
38
     * @return array
39
     */
40
    protected function buildData()
41
    {
42
        $this->getHead()->setOperation(static::OPERATION);
43
        $paymentRequestData = parent::buildData();
44
        $paymentRequestData['content'] = [
45
            $this->getShoppingBasket()->getRootTag() => $this->getShoppingBasket(),
46
        ];
47
48
        return $paymentRequestData;
49
    }
50
51
    /**
52
     * @return \SprykerEco\Zed\Ratepay\Business\Api\Builder\ShoppingBasketInterface
53
     */
54
    public function getShoppingBasket()
55
    {
56
        return $this->basket;
57
    }
58
}
59