Kint_Parsers_Xml   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 42.86%

Importance

Changes 0
Metric Value
dl 0
loc 34
ccs 6
cts 14
cp 0.4286
rs 10
c 0
b 0
f 0
wmc 5
lcom 1
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
B _parse() 0 26 5
1
<?php
2
3
namespace kint\parsers\custom;
4
5
use kint\inc\KintParser;
6
7
/**
8
 * Class Kint_Parsers_Xml
9
 */
10
class Kint_Parsers_Xml extends KintParser
11
{
12
  /**
13
   * @param mixed $variable
14
   *
15
   * @return bool
16
   */
17 1
  protected function _parse(&$variable)
18
  {
19
    try {
20
      if (
21 1
          (string)$variable === $variable
22
          &&
23 1
          0 === strpos($variable, '<?xml')
24
      ) {
25
        $e = libxml_use_internal_errors(true);
26
        $xml = simplexml_load_string($variable);
27
        libxml_use_internal_errors($e);
28
        if (empty($xml)) {
29
          return false;
30
        }
31
      } else {
32 1
        return false;
33
      }
34 1
    } catch (\Exception $e) {
35 1
      return false;
36
    }
37
38
    $this->value = KintParser::factory($xml)->extendedValue;
0 ignored issues
show
Documentation Bug introduced by
It seems like \kint\inc\KintParser::fa...ry($xml)->extendedValue of type array<integer,object<kint\inc\KintVariableData>> is incompatible with the declared type string of property $value.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
39
    $this->type = 'XML';
40
41
    return true;
42
  }
43
}
44