@@ -57,14 +57,14 @@ discard block |
||
| 57 | 57 | $trimmed = trim($lines); |
| 58 | 58 | $addressLines = preg_split("/\n/", $trimmed, null, PREG_SPLIT_NO_EMPTY); |
| 59 | 59 | |
| 60 | - $newLines = []; |
|
| 60 | + $newLines = [ ]; |
|
| 61 | 61 | foreach ($addressLines as $line) { |
| 62 | - $newLines[] = $this->cleanString($line, 70); |
|
| 62 | + $newLines[ ] = $this->cleanString($line, 70); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | if (count($newLines) > 4) { |
| 66 | 66 | // concat lines beyond the four allowed down into the last line |
| 67 | - $newLines[3] = $this->cleanString(implode(' ', array_slice($newLines, 3)), 70); |
|
| 67 | + $newLines[ 3 ] = $this->cleanString(implode(' ', array_slice($newLines, 3)), 70); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | $finalLines = array_slice($newLines, 0, 4); |
@@ -80,12 +80,12 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | protected function serializeShippingAddress() |
| 82 | 82 | { |
| 83 | - $lines = []; |
|
| 83 | + $lines = [ ]; |
|
| 84 | 84 | $idx = 0; |
| 85 | - $shipToLines = is_array($this->shipToLines) ? $this->shipToLines : []; |
|
| 85 | + $shipToLines = is_array($this->shipToLines) ? $this->shipToLines : [ ]; |
|
| 86 | 86 | foreach ($shipToLines as $line) { |
| 87 | 87 | $idx++; |
| 88 | - $lines[] = sprintf( |
|
| 88 | + $lines[ ] = sprintf( |
|
| 89 | 89 | '<Line%d>%s</Line%1$d>', |
| 90 | 90 | $idx, |
| 91 | 91 | $this->xmlEncode($line) |
@@ -109,8 +109,8 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function getResponseMessage() |
| 111 | 111 | { |
| 112 | - return isset($this->responseCodeMessage[$this->getResponseCode()]) |
|
| 113 | - ? $this->responseCodeMessage[$this->getResponseCode()] |
|
| 112 | + return isset($this->responseCodeMessage[ $this->getResponseCode() ]) |
|
| 113 | + ? $this->responseCodeMessage[ $this->getResponseCode() ] |
|
| 114 | 114 | : ''; |
| 115 | 115 | } |
| 116 | 116 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | protected function validateResponseCode() |
| 132 | 132 | { |
| 133 | - if (!isset($this->responseCodeMessage[$this->getResponseCode()])) { |
|
| 133 | + if (!isset($this->responseCodeMessage[ $this->getResponseCode() ])) { |
|
| 134 | 134 | throw new InvalidPayload("Unrecognized response code '{$this->getResponseCode()}'"); |
| 135 | 135 | } |
| 136 | 136 | } |
@@ -41,20 +41,20 @@ discard block |
||
| 41 | 41 | /** @var IPayload */ |
| 42 | 42 | protected $parentPayload; |
| 43 | 43 | /** @var array XPath expressions to extract required data from the serialized payload (XML) */ |
| 44 | - protected $extractionPaths = []; |
|
| 44 | + protected $extractionPaths = [ ]; |
|
| 45 | 45 | /** @var array */ |
| 46 | - protected $optionalExtractionPaths = []; |
|
| 46 | + protected $optionalExtractionPaths = [ ]; |
|
| 47 | 47 | /** @var array property/XPath pairs that take boolean values */ |
| 48 | - protected $booleanExtractionPaths = []; |
|
| 48 | + protected $booleanExtractionPaths = [ ]; |
|
| 49 | 49 | /** @var array pair address lines properties with xpaths for extraction */ |
| 50 | - protected $addressLinesExtractionMap = []; |
|
| 50 | + protected $addressLinesExtractionMap = [ ]; |
|
| 51 | 51 | /** @var array extracting node value and assigned the property as DateTime */ |
| 52 | - protected $datetimeExtractionPaths = []; |
|
| 52 | + protected $datetimeExtractionPaths = [ ]; |
|
| 53 | 53 | /** |
| 54 | 54 | * @var array property/XPath pairs. if property is a payload, first node matched |
| 55 | 55 | * will be deserialized by that payload |
| 56 | 56 | */ |
| 57 | - protected $subpayloadExtractionPaths = []; |
|
| 57 | + protected $subpayloadExtractionPaths = [ ]; |
|
| 58 | 58 | /** @var LoggerInterface enabled PSR-3 logging */ |
| 59 | 59 | protected $logger; |
| 60 | 60 | /** @var bool flag to determine to either serialize empty node not or to serialize empty node. */ |
@@ -156,8 +156,8 @@ discard block |
||
| 156 | 156 | protected function addressLinesFromXPath(\DOMXPath $domXPath) |
| 157 | 157 | { |
| 158 | 158 | foreach ($this->addressLinesExtractionMap as $address) { |
| 159 | - $lines = $domXPath->query($address['xPath']); |
|
| 160 | - $property = $address['property']; |
|
| 159 | + $lines = $domXPath->query($address[ 'xPath' ]); |
|
| 160 | + $property = $address[ 'property' ]; |
|
| 161 | 161 | $this->$property = $this->addressLinesFromNodeList($lines); |
| 162 | 162 | } |
| 163 | 163 | } |
@@ -172,9 +172,9 @@ discard block |
||
| 172 | 172 | */ |
| 173 | 173 | protected function addressLinesFromNodeList(\DOMNodeList $lines) |
| 174 | 174 | { |
| 175 | - $result = []; |
|
| 175 | + $result = [ ]; |
|
| 176 | 176 | foreach ($lines as $line) { |
| 177 | - $result[] = $line->nodeValue; |
|
| 177 | + $result[ ] = $line->nodeValue; |
|
| 178 | 178 | } |
| 179 | 179 | return $result ?: null; |
| 180 | 180 | } |
@@ -304,8 +304,8 @@ discard block |
||
| 304 | 304 | protected function serializeRootAttributes() |
| 305 | 305 | { |
| 306 | 306 | $rootAttributes = $this->getRootAttributes(); |
| 307 | - $qualifyAttributes = function ($name) use ($rootAttributes) { |
|
| 308 | - return sprintf('%s="%s"', $name, $this->xmlEncode($rootAttributes[$name])); |
|
| 307 | + $qualifyAttributes = function($name) use ($rootAttributes) { |
|
| 308 | + return sprintf('%s="%s"', $name, $this->xmlEncode($rootAttributes[ $name ])); |
|
| 309 | 309 | }; |
| 310 | 310 | $qualifiedAttributes = array_map($qualifyAttributes, array_keys($rootAttributes)); |
| 311 | 311 | return implode(' ', $qualifiedAttributes); |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | */ |
| 326 | 326 | protected function getRootAttributes() |
| 327 | 327 | { |
| 328 | - return []; |
|
| 328 | + return [ ]; |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | /** |
@@ -89,7 +89,7 @@ |
||
| 89 | 89 | |
| 90 | 90 | protected function getRootAttributes() |
| 91 | 91 | { |
| 92 | - return $this->getId() ? ['id' => $this->getId()] : []; |
|
| 92 | + return $this->getId() ? [ 'id' => $this->getId() ] : [ ]; |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | protected function getRootNodeName() |
@@ -118,9 +118,9 @@ |
||
| 118 | 118 | |
| 119 | 119 | protected function getRootAttributes() |
| 120 | 120 | { |
| 121 | - $attrs = ['id' => $this->getId()]; |
|
| 121 | + $attrs = [ 'id' => $this->getId() ]; |
|
| 122 | 122 | if ($this->getChargeType()) { |
| 123 | - $attrs['chargeType'] = $this->getChargeType(); |
|
| 123 | + $attrs[ 'chargeType' ] = $this->getChargeType(); |
|
| 124 | 124 | } |
| 125 | 125 | return $attrs; |
| 126 | 126 | } |
@@ -152,13 +152,13 @@ |
||
| 152 | 152 | */ |
| 153 | 153 | protected function getRootAttributes() |
| 154 | 154 | { |
| 155 | - $attrs = []; |
|
| 155 | + $attrs = [ ]; |
|
| 156 | 156 | if ($this->getId()) { |
| 157 | - $attrs['id'] = $this->getId(); |
|
| 157 | + $attrs[ 'id' ] = $this->getId(); |
|
| 158 | 158 | } |
| 159 | 159 | $flag = $this->getCalculateDutyFlag(); |
| 160 | 160 | if ($flag === true || $flag === false) { |
| 161 | - $attrs['calculateDuty'] = $this->convertBooleanToString($this->getCalculateDutyFlag()); |
|
| 161 | + $attrs[ 'calculateDuty' ] = $this->convertBooleanToString($this->getCalculateDutyFlag()); |
|
| 162 | 162 | } |
| 163 | 163 | return $attrs; |
| 164 | 164 | } |
@@ -91,7 +91,7 @@ |
||
| 91 | 91 | |
| 92 | 92 | protected function getRootAttributes() |
| 93 | 93 | { |
| 94 | - return ['id' => $this->getId()]; |
|
| 94 | + return [ 'id' => $this->getId() ]; |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | protected function buildPhysicalAddressNodes(array $lines) |
@@ -161,7 +161,7 @@ |
||
| 161 | 161 | foreach ($itemPrices as $property => $extractionPath) { |
| 162 | 162 | $priceNode = $xpath->query($extractionPath)->item(0); |
| 163 | 163 | if ($priceNode) { |
| 164 | - $getter = $priceGroupGetters[$property]; |
|
| 164 | + $getter = $priceGroupGetters[ $property ]; |
|
| 165 | 165 | $this->$property = $this->$getter()->deserialize($priceNode->C14N()); |
| 166 | 166 | } |
| 167 | 167 | } |
@@ -225,7 +225,7 @@ |
||
| 225 | 225 | |
| 226 | 226 | protected function serializeVatInclusivePricing() |
| 227 | 227 | { |
| 228 | - $flag =$this->getVatInclusivePricingFlag(); |
|
| 228 | + $flag = $this->getVatInclusivePricingFlag(); |
|
| 229 | 229 | if ($flag === true || $flag === false) { |
| 230 | 230 | $flag = $this->convertBooleanToString($flag); |
| 231 | 231 | return "<VATInclusivePricing>$flag</VATInclusivePricing>"; |