| Conditions | 19 |
| Paths | 239 |
| Total Lines | 83 |
| Code Lines | 63 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 192 | public static function marshalObject($domElement, $node, $name, $object, $namespace = NULL, $root = false) |
||
| 193 | { |
||
| 194 | if (is_null($object)) { |
||
| 195 | return; |
||
| 196 | } |
||
| 197 | if ($root) { |
||
| 198 | $childNode = $node; |
||
| 199 | } else { |
||
| 200 | if ($object->getValue()) { |
||
| 201 | $val = preg_replace('/&/', '&', $object->getValue()); |
||
| 202 | if ($object->getType() === 'cdata') { |
||
| 203 | $childNode = $domElement->createElement($name); |
||
| 204 | $cdata = $domElement->createCDATASection(strval($val)); |
||
| 205 | $childNode->appendChild($cdata); |
||
| 206 | $node->appendChild($nextChild); |
||
| 207 | } else { |
||
| 208 | $childNode = $domElement->createElement($name, $val); |
||
| 209 | } |
||
| 210 | $node->appendChild($childNode); |
||
| 211 | } else { |
||
| 212 | $childNode = $domElement->createElement($name); |
||
| 213 | $node->appendChild($childNode); |
||
| 214 | } |
||
| 215 | if (!empty($namespace)) { |
||
| 216 | $ns = $domElement->createAttributeNS(null,'xmlns'); |
||
| 217 | $ns->value = $namespace; |
||
| 218 | $childNode->appendChild($ns); |
||
| 219 | } |
||
| 220 | } |
||
| 221 | |||
| 222 | if ($object->areAttributes()) { |
||
| 223 | $attrs = $object->getAttributes(); |
||
| 224 | foreach ($attrs as $attrt => $attrv) { |
||
| 225 | $attrE = $domElement->createAttribute($attrt); |
||
| 226 | $attrE->value = $attrv; |
||
| 227 | $childNode->appendChild($attrE); |
||
| 228 | } |
||
| 229 | } |
||
| 230 | |||
| 231 | if (empty($object->children)) { |
||
| 232 | return; |
||
| 233 | } |
||
| 234 | foreach ($object->children as $child) { |
||
| 235 | $nameC = $child['name']; |
||
| 236 | $valueC = $child['value']; |
||
| 237 | $namespaceC = $child['namespace']; |
||
| 238 | if (is_scalar($valueC)) { |
||
| 239 | $cl = strval($valueC); |
||
| 240 | $nextChild = $domElement->createElement($nameC, $cl); |
||
| 241 | $childNode->appendChild($nextChild); |
||
| 242 | if (!empty($namespaceC)) { |
||
| 243 | $ns = $domElement->createAttributeNS(null,'xmlns'); |
||
| 244 | $ns->value = $namespaceC; |
||
| 245 | $nextChild->appendChild($ns); |
||
| 246 | } |
||
| 247 | continue; |
||
| 248 | } |
||
| 249 | if (gettype($valueC) == 'array') { |
||
| 250 | foreach ($valueC as $insideValue) { |
||
| 251 | if (is_object($insideValue)) { |
||
| 252 | DeviceXMLmain::marshalObject($domElement, $childNode, $nameC, $insideValue, $namespaceC); |
||
| 253 | } |
||
| 254 | if (is_scalar($insideValue)) { |
||
| 255 | if ($child['type'] === 'cdata') { |
||
| 256 | $nextChild = $domElement->createElement($nameC); |
||
| 257 | $cdata = $domElement->createCDATASection(strval($insideValue)); |
||
| 258 | $nextChild->appendChild($cdata); |
||
| 259 | $childNode->appendChild($nextChild); |
||
| 260 | } else { |
||
| 261 | $nextChild = $domElement->createElement($nameC, strval($insideValue)); |
||
| 262 | $childNode->appendChild($nextChild); |
||
| 263 | } |
||
| 264 | if (!empty($namespaceC)) { |
||
| 265 | $ns = $domElement->createAttributeNS(null,'xmlns'); |
||
| 266 | $ns->value = $namespaceC; |
||
| 267 | $nextChild->appendChild($ns); |
||
| 268 | } |
||
| 269 | } |
||
| 270 | } |
||
| 271 | continue; |
||
| 272 | } |
||
| 273 | if (gettype($valueC) == 'object') { |
||
| 274 | DeviceXMLmain::marshalObject($domElement, $childNode, $nameC, $valueC, $namespaceC); |
||
| 275 | } |
||
| 281 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths