Base   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 47
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getRootTag() 0 3 1
A __construct() 0 3 1
A getHead() 0 3 1
A buildData() 0 7 1
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;
9
10
use SprykerEco\Shared\Ratepay\RatepayConfig;
11
use SprykerEco\Zed\Ratepay\Business\Api\Builder\HeadInterface;
12
13
abstract class Base extends AbstractRequest
14
{
15
    public const ROOT_TAG = 'request';
16
    public const CONTENT = 'content';
17
18
    public const OPERATION = '';
19
20
    /**
21
     * @var \SprykerEco\Zed\Ratepay\Business\Api\Builder\HeadInterface
22
     */
23
    protected $head;
24
25
    /**
26
     * @param \SprykerEco\Zed\Ratepay\Business\Api\Builder\HeadInterface $head
27
     */
28
    public function __construct(HeadInterface $head)
29
    {
30
        $this->head = $head;
31
    }
32
33
    /**
34
     * @return array
35
     */
36
    protected function buildData()
37
    {
38
        $this->getHead()->setOperation(static::OPERATION);
39
        return [
40
            '@version' => RatepayConfig::RATEPAY_REQUEST_VERSION,
41
            '@xmlns' => RatepayConfig::RATEPAY_REQUEST_XMLNS_URN,
42
            $this->getHead()->getRootTag() => $this->getHead(),
43
        ];
44
    }
45
46
    /**
47
     * @return string
48
     */
49
    public function getRootTag()
50
    {
51
        return static::ROOT_TAG;
52
    }
53
54
    /**
55
     * @return \SprykerEco\Zed\Ratepay\Business\Api\Builder\HeadInterface
56
     */
57
    public function getHead()
58
    {
59
        return $this->head;
60
    }
61
}
62