|
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\Builder; |
|
9
|
|
|
|
|
10
|
|
|
use Generated\Shared\Transfer\RatepayRequestTransfer; |
|
|
|
|
|
|
11
|
|
|
use SprykerEco\Zed\Ratepay\Business\Api\Constants; |
|
12
|
|
|
|
|
13
|
|
|
class Address extends AbstractBuilder implements AddressInterface |
|
14
|
|
|
{ |
|
15
|
|
|
public const ROOT_TAG = 'address'; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* @var string |
|
19
|
|
|
*/ |
|
20
|
|
|
protected $addressType; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* @param \Generated\Shared\Transfer\RatepayRequestTransfer $requestTransfer |
|
24
|
|
|
* @param string $addressType |
|
25
|
|
|
*/ |
|
26
|
|
|
public function __construct(RatepayRequestTransfer $requestTransfer, $addressType) |
|
27
|
|
|
{ |
|
28
|
|
|
parent::__construct($requestTransfer); |
|
29
|
|
|
|
|
30
|
|
|
$this->addressType = $addressType; |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @return array |
|
35
|
|
|
*/ |
|
36
|
|
|
public function buildData() |
|
37
|
|
|
{ |
|
38
|
|
|
$addressTransfer = ($this->addressType == Constants::REQUEST_MODEL_ADDRESS_TYPE_BILLING) |
|
39
|
|
|
? $this->requestTransfer->getBillingAddress() |
|
40
|
|
|
: $this->requestTransfer->getShippingAddress(); |
|
41
|
|
|
|
|
42
|
|
|
$result = ['@type' => $this->addressType]; |
|
43
|
|
|
if ($addressTransfer->getFirstName() !== null) { |
|
44
|
|
|
$result['first-name'] = $addressTransfer->getFirstName(); |
|
45
|
|
|
} |
|
46
|
|
|
if ($addressTransfer->getLastName() !== null) { |
|
47
|
|
|
$result['last-name'] = $addressTransfer->getLastName(); |
|
48
|
|
|
} |
|
49
|
|
|
$result = array_merge( |
|
50
|
|
|
$result, |
|
51
|
|
|
[ |
|
52
|
|
|
'street' => $addressTransfer->getStreet(), |
|
53
|
|
|
'street-additional' => $addressTransfer->getStreetAdditional(), |
|
54
|
|
|
'street-number' => $addressTransfer->getStreetNumber(), |
|
55
|
|
|
'zip-code' => $addressTransfer->getZipCode(), |
|
56
|
|
|
'city' => $addressTransfer->getCity(), |
|
57
|
|
|
'country-code' => $addressTransfer->getCountryCode(), |
|
58
|
|
|
] |
|
59
|
|
|
); |
|
60
|
|
|
|
|
61
|
|
|
return $result; |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* @return string |
|
66
|
|
|
*/ |
|
67
|
|
|
public function getRootTag() |
|
68
|
|
|
{ |
|
69
|
|
|
return static::ROOT_TAG; |
|
70
|
|
|
} |
|
71
|
|
|
} |
|
72
|
|
|
|
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths