Completed
Push — master ( cf7247...7c3177 )
by Lars
04:07
created

Kint_Parsers_ObjectIterateable::_parse()   B

Complexity

Conditions 5
Paths 3

Size

Total Lines 23
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 23
rs 8.5906
cc 5
eloc 13
nc 3
nop 1
1
<?php
2
3
namespace kint\parsers\custom;
4
5
use kint\inc\KintParser;
6
7
/**
8
 * Class Kint_Parsers_ObjectIterateable
9
 */
10
class Kint_Parsers_ObjectIterateable extends KintParser
11
{
12
  /**
13
   * @param mixed $variable
14
   *
15
   * @return bool
16
   */
17
  protected function _parse(&$variable)
18
  {
19
    if (
20
        !is_object($variable)
21
        || !$variable instanceof \Traversable
22
        || stripos(get_class($variable), 'zend') !== false // zf2 PDO wrapper does not play nice
23
    ) {
24
      return false;
25
    }
26
27
28
    $arrayCopy = iterator_to_array($variable, true);
29
30
    if ($arrayCopy === false) {
31
      return false;
32
    }
33
34
    $this->value = KintParser::factory($arrayCopy)->extendedValue;
0 ignored issues
show
Documentation Bug introduced by
It seems like \kint\inc\KintParser::fa...rayCopy)->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...
35
    $this->type = 'Iterator contents';
36
    $this->size = count($arrayCopy);
37
    
38
    return true;
39
  }
40
}