@@ -101,6 +101,10 @@ discard block |
||
101 | 101 | var_dump(isInteger(NULL)); //bool(false) |
102 | 102 | var_dump(isInteger("")); //bool(false) |
103 | 103 | */ |
104 | + |
|
105 | + /** |
|
106 | + * @param string $input |
|
107 | + */ |
|
104 | 108 | protected function isInteger($input) |
105 | 109 | { |
106 | 110 | return(ctype_digit(strval($input))); |
@@ -116,6 +120,10 @@ discard block |
||
116 | 120 | var_dump(isBool(NULL)); //bool(false) |
117 | 121 | var_dump(isBool("")); //bool(false) |
118 | 122 | */ |
123 | + |
|
124 | + /** |
|
125 | + * @param string $input |
|
126 | + */ |
|
119 | 127 | protected function isBool($input) |
120 | 128 | { |
121 | 129 | return in_array(strtolower($input), ['true', 'false']) !== false; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | protected function convertAttributes($attributes) |
69 | 69 | { |
70 | - foreach($attributes as $k=>$attribute) |
|
70 | + foreach ($attributes as $k=>$attribute) |
|
71 | 71 | { |
72 | 72 | $attributes[$k] = $this->convertValue($attribute); |
73 | 73 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | |
138 | 138 | if (is_array($this->value)) { |
139 | 139 | $results = []; |
140 | - foreach($this->value as $value) { |
|
140 | + foreach ($this->value as $value) { |
|
141 | 141 | if ($value instanceof XMLReaderElement && |
142 | 142 | $this->namespace === $value->namespace) { |
143 | 143 | $results[] = $value; |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | if ($this->name == $search) |
162 | 162 | $results[] = $this; |
163 | 163 | |
164 | - foreach($this->children() as $child) { |
|
164 | + foreach ($this->children() as $child) { |
|
165 | 165 | $results = array_merge($results, $child->find($search)); |
166 | 166 | } |
167 | 167 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | { |
179 | 179 | if (is_array($this->value)) |
180 | 180 | { |
181 | - foreach($this->value as $value) |
|
181 | + foreach ($this->value as $value) |
|
182 | 182 | { |
183 | 183 | if ($value instanceof XMLReaderElement && $value->name == $name) |
184 | 184 | return $value; |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | |
203 | 203 | if (!empty($this->children())) { |
204 | 204 | $names = []; |
205 | - foreach($this->children() as $child) { |
|
205 | + foreach ($this->children() as $child) { |
|
206 | 206 | $names[] = $child->name; |
207 | 207 | } |
208 | 208 |
@@ -158,8 +158,9 @@ discard block |
||
158 | 158 | |
159 | 159 | $results = []; |
160 | 160 | |
161 | - if ($this->name == $search) |
|
162 | - $results[] = $this; |
|
161 | + if ($this->name == $search) { |
|
162 | + $results[] = $this; |
|
163 | + } |
|
163 | 164 | |
164 | 165 | foreach($this->children() as $child) { |
165 | 166 | $results = array_merge($results, $child->find($search)); |
@@ -167,8 +168,9 @@ discard block |
||
167 | 168 | |
168 | 169 | if ($search[0] == '@') { |
169 | 170 | $search = substr($search, 1); |
170 | - if (property_exists($this->attributes, $search)) |
|
171 | - $results[] = $this->attributes->$search; |
|
171 | + if (property_exists($this->attributes, $search)) { |
|
172 | + $results[] = $this->attributes->$search; |
|
173 | + } |
|
172 | 174 | } |
173 | 175 | |
174 | 176 | return $results; |
@@ -180,8 +182,9 @@ discard block |
||
180 | 182 | { |
181 | 183 | foreach($this->value as $value) |
182 | 184 | { |
183 | - if ($value instanceof XMLReaderElement && $value->name == $name) |
|
184 | - return $value; |
|
185 | + if ($value instanceof XMLReaderElement && $value->name == $name) { |
|
186 | + return $value; |
|
187 | + } |
|
185 | 188 | } |
186 | 189 | } |
187 | 190 |