1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Ups\Entity; |
4
|
|
|
|
5
|
|
|
use DOMDocument; |
6
|
|
|
use DOMElement; |
7
|
|
|
use DOMNode; |
8
|
|
|
use Ups\NodeInterface; |
9
|
|
|
|
10
|
|
|
class SearchFilter implements NodeInterface |
11
|
|
|
{ |
12
|
|
|
/** |
13
|
|
|
* @var bool |
14
|
|
|
*/ |
15
|
|
|
private $dcrIndicator; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @var bool |
19
|
|
|
*/ |
20
|
|
|
private $shippingAvailabilityIndicator; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @var int |
24
|
|
|
*/ |
25
|
|
|
private $shipperPreparationDelay; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var string |
29
|
|
|
*/ |
30
|
|
|
private $clickAndCollectSortWithDistance; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @param null|DOMDocument $document |
34
|
|
|
* |
35
|
|
|
* @return DOMNode |
36
|
|
|
*/ |
37
|
|
|
public function toNode(DOMDocument $document = null) |
38
|
|
|
{ |
39
|
|
|
if (null === $document) { |
40
|
|
|
$document = new DOMDocument(); |
41
|
|
|
} |
42
|
|
|
/** @var DOMElement $node */ |
43
|
|
|
$node = $document->createElement('SearchFilter'); |
44
|
|
|
|
45
|
|
|
if ($this->getDcrIndicator()) { |
46
|
|
|
$node->appendChild($document->createElement('DCRIndicator')); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
if ($this->getShippingAvailabilityIndicator()) { |
50
|
|
|
$node->appendChild($document->createElement('ShippingAvailabilityIndicator')); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
|
54
|
|
|
if ($this->getShipperPreparationDelay()) { |
55
|
|
|
$node->appendChild($document->createElement('ShipperPreparationDelay', strval($this->getShipperPreparationDelay()))); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
|
59
|
|
|
if ($this->getClickAndCollectSortWithDistance()) { |
60
|
|
|
$node->appendChild($document->createElement('ClickAndCollectSortWithDistance', strval($this->getClickAndCollectSortWithDistance()))); |
61
|
|
|
|
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
return $node; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @return bool |
69
|
|
|
*/ |
70
|
|
|
public function getDcrIndicator() |
71
|
|
|
{ |
72
|
|
|
return $this->dcrIndicator; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @param bool $dcrIndicator |
77
|
|
|
*/ |
78
|
|
|
public function setDcrIndicator($dcrIndicator) |
79
|
|
|
{ |
80
|
|
|
$this->dcrIndicator = $dcrIndicator; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @return bool |
85
|
|
|
*/ |
86
|
|
|
public function getShippingAvailabilityIndicator() |
87
|
|
|
{ |
88
|
|
|
return $this->shippingAvailabilityIndicator; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @param bool $shippingAvailabilityIndicator |
93
|
|
|
*/ |
94
|
|
|
public function setShippingAvailabilityIndicator($shippingAvailabilityIndicator) |
95
|
|
|
{ |
96
|
|
|
$this->shippingAvailabilityIndicator = $shippingAvailabilityIndicator; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @return int |
101
|
|
|
*/ |
102
|
|
|
public function getShipperPreparationDelay() |
103
|
|
|
{ |
104
|
|
|
return $this->shipperPreparationDelay; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* @param int $shipperPreparationDelay |
109
|
|
|
*/ |
110
|
|
|
public function setShipperPreparationDelay($shipperPreparationDelay) |
111
|
|
|
{ |
112
|
|
|
$this->shipperPreparationDelay = $shipperPreparationDelay; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* @return string |
117
|
|
|
*/ |
118
|
|
|
public function getClickAndCollectSortWithDistance() |
119
|
|
|
{ |
120
|
|
|
return $this->clickAndCollectSortWithDistance; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* @param string $clickAndCollectSortWithDistance |
125
|
|
|
*/ |
126
|
|
|
public function setClickAndCollectSortWithDistance($clickAndCollectSortWithDistance) |
127
|
|
|
{ |
128
|
|
|
$this->clickAndCollectSortWithDistance = $clickAndCollectSortWithDistance; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
} |