MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
Dumper.php
Ir para a documentação deste ficheiro.
1<?php
2
4
5/*
6 * This file is part of the symfony package.
7 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
8 *
9 * For the full copyright and license information, please view the LICENSE
10 * file that was distributed with this source code.
11 */
12
20class Dumper
21{
31 public function dump($input, $inline = 0, $indent = 0)
32 {
33 $output = '';
34 $prefix = $indent ? str_repeat(' ', $indent) : '';
35
36 if ($inline <= 0 || !is_array($input) || empty($input))
37 {
38 $output .= $prefix.Inline::dump($input);
39 }
40 else
41 {
42 $isAHash = array_keys($input) !== range(0, count($input) - 1);
43
44 foreach ($input as $key => $value)
45 {
46 $willBeInlined = $inline - 1 <= 0 || !is_array($value) || empty($value);
47
48 $output .= sprintf('%s%s%s%s',
49 $prefix,
50 $isAHash ? Inline::dump($key).':' : '-',
51 $willBeInlined ? ' ' : "\n",
52 $this->dump($value, $inline - 1, $willBeInlined ? 0 : $indent + 2)
53 ).($willBeInlined ? "\n" : '');
54 }
55 }
56
57 return $output;
58 }
59}
dump($input, $inline=0, $indent=0)
Definição Dumper.php:31