Completed
Push — master ( 47f526...6c6127 )
by Lars
02:53
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 3
Bugs 0 Features 0
Metric Value
c 3
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
 * @package kint\parsers\custom
11
 */
12
class Kint_Parsers_ObjectIterateable extends KintParser
13
{
14
  /**
15
   * @param mixed $variable
16
   *
17
   * @return bool
18
   */
19
  protected function _parse(&$variable)
20
  {
21
    if (
22
        !is_object($variable)
23
        || !$variable instanceof \Traversable
24
        || stripos(get_class($variable), 'zend') !== false // zf2 PDO wrapper does not play nice
25
    ) {
26
      return false;
27
    }
28
29
30
    $arrayCopy = iterator_to_array($variable, true);
31
32
    if ($arrayCopy === false) {
33
      return false;
34
    }
35
36
    $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...
37
    $this->type = 'Iterator contents';
38
    $this->size = count($arrayCopy);
39
40
    return true;
41
  }
42
}
43