@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | class XmlResponse extends Response |
| 13 | 13 | { |
| 14 | 14 | |
| 15 | - public function __construct ($content = []) |
|
| 15 | + public function __construct($content = []) |
|
| 16 | 16 | { |
| 17 | 17 | parent::__construct($content); |
| 18 | 18 | |
@@ -27,30 +27,30 @@ discard block |
||
| 27 | 27 | * @param $data |
| 28 | 28 | * @return bool|\DOMElement |
| 29 | 29 | */ |
| 30 | - protected function generateXmlElement( \DOMDocument $dom, $data ) |
|
| 30 | + protected function generateXmlElement(\DOMDocument $dom, $data) |
|
| 31 | 31 | { |
| 32 | - if ( empty( $data['name'] ) ) |
|
| 32 | + if (empty($data['name'])) |
|
| 33 | 33 | return false; |
| 34 | 34 | |
| 35 | 35 | // Create the element |
| 36 | - $element_value = ( ! empty( $data['value'] ) ) ? $data['value'] : null; |
|
| 37 | - $element = $dom->createElement( $data['name'], $element_value ); |
|
| 36 | + $element_value = (!empty($data['value'])) ? $data['value'] : null; |
|
| 37 | + $element = $dom->createElement($data['name'], $element_value); |
|
| 38 | 38 | |
| 39 | 39 | // Add any attributes |
| 40 | - if ( ! empty( $data['attributes'] ) && is_array( $data['attributes'] ) ) { |
|
| 41 | - foreach ( $data['attributes'] as $attribute_key => $attribute_value ) { |
|
| 42 | - $element->setAttribute( $attribute_key, $attribute_value ); |
|
| 40 | + if (!empty($data['attributes']) && is_array($data['attributes'])) { |
|
| 41 | + foreach ($data['attributes'] as $attribute_key => $attribute_value) { |
|
| 42 | + $element->setAttribute($attribute_key, $attribute_value); |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | // Any other items in the data array should be child elements |
| 47 | - foreach ( $data as $data_key => $child_data ) { |
|
| 48 | - if ( ! is_numeric( $data_key ) ) |
|
| 47 | + foreach ($data as $data_key => $child_data) { |
|
| 48 | + if (!is_numeric($data_key)) |
|
| 49 | 49 | continue; |
| 50 | 50 | |
| 51 | - $child = $this->generateXmlElement( $dom, $child_data ); |
|
| 52 | - if ( $child ) |
|
| 53 | - $element->appendChild( $child ); |
|
| 51 | + $child = $this->generateXmlElement($dom, $child_data); |
|
| 52 | + if ($child) |
|
| 53 | + $element->appendChild($child); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | return $element; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $doc->encoding = 'UTF-8'; |
| 71 | 71 | $child = $this->generateXmlElement($doc, $content); |
| 72 | 72 | |
| 73 | - if ( $child ) { |
|
| 73 | + if ($child) { |
|
| 74 | 74 | $doc->appendChild($child); |
| 75 | 75 | } |
| 76 | 76 | |