@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * |
18 | 18 | * @param array $content |
19 | 19 | */ |
20 | - public function __construct ($content = []) |
|
20 | + public function __construct($content = []) |
|
21 | 21 | { |
22 | 22 | parent::__construct($content); |
23 | 23 | $this->setContent($content); |
@@ -31,30 +31,30 @@ discard block |
||
31 | 31 | * @param $data |
32 | 32 | * @return bool|\DOMElement |
33 | 33 | */ |
34 | - protected function generateXmlElement(\DOMDocument $dom, $data ) |
|
34 | + protected function generateXmlElement(\DOMDocument $dom, $data) |
|
35 | 35 | { |
36 | - if ( empty( $data['name'] ) ) |
|
36 | + if (empty($data['name'])) |
|
37 | 37 | return false; |
38 | 38 | |
39 | 39 | // Create the element |
40 | - $element_value = ( ! empty( $data['value'] ) ) ? $data['value'] : null; |
|
41 | - $element = $dom->createElement( $data['name'], $element_value ); |
|
40 | + $element_value = (!empty($data['value'])) ? $data['value'] : null; |
|
41 | + $element = $dom->createElement($data['name'], $element_value); |
|
42 | 42 | |
43 | 43 | // Add any attributes |
44 | - if ( ! empty( $data['attributes'] ) && is_array( $data['attributes'] ) ) { |
|
45 | - foreach ( $data['attributes'] as $attribute_key => $attribute_value ) { |
|
46 | - $element->setAttribute( $attribute_key, $attribute_value ); |
|
44 | + if (!empty($data['attributes']) && is_array($data['attributes'])) { |
|
45 | + foreach ($data['attributes'] as $attribute_key => $attribute_value) { |
|
46 | + $element->setAttribute($attribute_key, $attribute_value); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
50 | 50 | // Any other items in the data array should be child elements |
51 | - foreach ( $data as $data_key => $child_data ) { |
|
52 | - if ( ! is_numeric( $data_key ) ) |
|
51 | + foreach ($data as $data_key => $child_data) { |
|
52 | + if (!is_numeric($data_key)) |
|
53 | 53 | continue; |
54 | 54 | |
55 | - $child = $this->generateXmlElement( $dom, $child_data ); |
|
56 | - if ( $child ) |
|
57 | - $element->appendChild( $child ); |
|
55 | + $child = $this->generateXmlElement($dom, $child_data); |
|
56 | + if ($child) |
|
57 | + $element->appendChild($child); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | return $element; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $doc->encoding = 'UTF-8'; |
75 | 75 | $child = $this->generateXmlElement($doc, $content); |
76 | 76 | |
77 | - if ( $child ) { |
|
77 | + if ($child) { |
|
78 | 78 | $doc->appendChild($child); |
79 | 79 | } |
80 | 80 |