You are here

protected function Kint_Parsers_SplObjectStorage::_parse in Devel 8.2

Same name and namespace in other branches
  1. 8 kint/kint/parsers/custom/splobjectstorage.php \Kint_Parsers_SplObjectStorage::_parse()

* main and usually single method a custom parser must implement * *

Parameters

mixed $variable: * * @return mixed [!!!] false is returned if the variable is not of current type

Overrides kintParser::_parse

File

kint/kint/parsers/custom/splobjectstorage.php, line 5

Class

Kint_Parsers_SplObjectStorage

Code

protected function _parse(&$variable) {
  if (!is_object($variable) || !$variable instanceof SplObjectStorage) {
    return false;
  }

  /** @var $variable SplObjectStorage */
  $count = $variable
    ->count();
  if ($count === 0) {
    return false;
  }
  $variable
    ->rewind();
  while ($variable
    ->valid()) {
    $current = $variable
      ->current();
    $this->value[] = kintParser::factory($current);
    $variable
      ->next();
  }
  $this->type = 'Storage contents';
  $this->size = $count;
}