1 | <?php |
||
27 | class EddMessage implements IEddMessage |
||
28 | { |
||
29 | use TPayload, TDeliveryWindow; |
||
30 | |||
31 | /** @var string */ |
||
32 | protected $mode; |
||
33 | /** @var string */ |
||
34 | protected $messageType; |
||
35 | /** @var string */ |
||
36 | protected $template; |
||
37 | |||
38 | /** |
||
39 | * @param IValidatorIterator |
||
40 | * @param ISchemaValidator |
||
41 | * @param IPayloadMap |
||
42 | * @param LoggerInterface |
||
43 | * @param IPayload |
||
44 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
||
45 | */ |
||
46 | public function __construct( |
||
47 | IValidatorIterator $validators, |
||
48 | ISchemaValidator $schemaValidator, |
||
|
|||
49 | IPayloadMap $payloadMap, |
||
50 | LoggerInterface $logger, |
||
51 | IPayload $parentPayload = null |
||
52 | ) { |
||
53 | $this->logger = $logger; |
||
54 | $this->validators = $validators; |
||
55 | $this->parentPayload = $parentPayload; |
||
56 | |||
57 | $this->extractionPaths = [ |
||
58 | 'mode' => 'string(x:Mode)', |
||
59 | 'messageType' => 'string(x:MessageType)', |
||
60 | 'template' => 'string(x:Template)', |
||
61 | ]; |
||
62 | $this->optionalExtractionPaths = [ |
||
63 | 'to' => 'x:DeliveryWindow/x:To', |
||
64 | 'from' => 'x:DeliveryWindow/x:From', |
||
65 | ]; |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * @param string |
||
70 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
||
71 | */ |
||
72 | protected function deserializeExtra($serializedPayload) |
||
73 | { |
||
74 | $from = $this->getFrom(); |
||
75 | $to = $this->getTo(); |
||
76 | if (!$from instanceof DateTime && !empty($from) && is_string($from)) { |
||
77 | $this->setFrom($from); |
||
78 | } |
||
79 | if (!$to instanceof DateTime && !empty($to) && is_string($to)) { |
||
80 | $this->setTo($to); |
||
81 | } |
||
82 | return $this; |
||
83 | } |
||
84 | |||
85 | public function getMode() |
||
89 | |||
90 | public function setMode($mode) |
||
91 | { |
||
92 | $this->mode = $mode; |
||
93 | return $this; |
||
94 | } |
||
95 | |||
96 | public function getMessageType() |
||
100 | |||
101 | public function setMessageType($messageType) |
||
102 | { |
||
103 | $this->messageType = $messageType; |
||
104 | return $this; |
||
105 | } |
||
106 | |||
107 | public function getTemplate() |
||
111 | |||
112 | public function setTemplate($template) |
||
113 | { |
||
114 | $this->template = $template; |
||
115 | return $this; |
||
116 | } |
||
117 | |||
118 | protected function getRootNodeName() |
||
122 | |||
123 | protected function getRootAttributes() |
||
127 | |||
128 | protected function serializeContents() |
||
129 | { |
||
130 | return $this->serializeMode() |
||
131 | . $this->serializeMessageType() |
||
132 | . $this->serializeTemplate() |
||
133 | . $this->serializeDeliveryWindow(); |
||
134 | } |
||
135 | |||
136 | protected function serializeMode() |
||
137 | { |
||
138 | $mode = $this->getMode(); |
||
139 | return (!empty($mode) && is_string($mode)) |
||
140 | ? "<Mode>$mode</Mode>" : ''; |
||
141 | } |
||
142 | |||
143 | protected function serializeMessageType() |
||
144 | { |
||
145 | $messageType = $this->getMessageType(); |
||
146 | return (!empty($messageType) && is_string($messageType)) |
||
147 | ? "<MessageType>$messageType</MessageType>" : ''; |
||
148 | } |
||
149 | |||
150 | protected function serializeTemplate() |
||
151 | { |
||
152 | $template = $this->getTemplate(); |
||
153 | return (!empty($template) && is_string($template)) |
||
154 | ? "<Template>$template</Template>" : ''; |
||
155 | } |
||
156 | |||
157 | protected function getXmlNamespace() |
||
161 | } |
||
162 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.