Exemplo n.º 1
0
 public function parse(&$variable, \Kint\Object $o)
 {
     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[] = Parser::factory($current);
         $variable->next();
     }
     $this->type = 'Storage contents';
     $this->size = $count;
 }
Exemplo n.º 2
0
 public static function decorateTrace($traceData)
 {
     $output = self::_title('TRACE');
     $lastStep = count($traceData);
     foreach ($traceData as $stepNo => $step) {
         $title = str_pad(++$stepNo . ': ', 4, ' ');
         $title .= self::_colorize(isset($step['file']) ? self::_buildCalleeString($step) : 'PHP internal call', 'title');
         if (!empty($step['function'])) {
             $title .= '    ' . $step['function'];
             if (isset($step['args'])) {
                 $title .= '(';
                 if (empty($step['args'])) {
                     $title .= ')';
                 } else {
                 }
                 $title .= PHP_EOL;
             }
         }
         $output .= $title;
         if (!empty($step['args'])) {
             $appendDollar = $step['function'] === '{closure}' ? '' : '$';
             $i = 0;
             foreach ($step['args'] as $name => $argument) {
                 $argument = Parser::factory($argument, $name ? $appendDollar . $name : '#' . ++$i);
                 $argument->operator = $name ? ' =' : ':';
                 $maxLevels = Kint::$maxLevels;
                 if ($maxLevels) {
                     Kint::$maxLevels = $maxLevels + 2;
                 }
                 $output .= self::decorate($argument, 2);
                 if ($maxLevels) {
                     Kint::$maxLevels = $maxLevels;
                 }
             }
             $output .= '    )' . PHP_EOL;
         }
         if (!empty($step['object'])) {
             $output .= self::_colorize('    ' . self::_char('─', 27) . ' Callee object ' . self::_char('─', 34), 'title');
             $maxLevels = Kint::$maxLevels;
             if ($maxLevels) {
                 // in cli the terminal window is filled too quickly to display huge objects
                 Kint::$maxLevels = Kint::$enabledMode === Kint::MODE_CLI ? 1 : $maxLevels + 1;
             }
             $output .= self::decorate(Parser::factory($step['object']), 1);
             if ($maxLevels) {
                 Kint::$maxLevels = $maxLevels;
             }
         }
         if ($stepNo !== $lastStep) {
             $output .= self::_colorize(self::_char('─', 80), 'title');
         }
     }
     return $output;
 }