run:R W Run
DIR
2026-04-08 19:37:33
R W Run
DIR
2026-04-08 19:37:34
R W Run
DIR
2026-04-08 19:37:35
R W Run
5.92 KB
2026-04-08 19:31:36
R W Run
5.08 KB
2026-04-08 19:31:38
R W Run
3.99 KB
2026-04-08 19:31:37
R W Run
30.5 KB
2026-04-08 19:31:38
R W Run
1.04 KB
2026-04-08 19:31:36
R W Run
47.67 KB
2026-04-08 19:31:36
R W Run
457 By
2026-04-08 19:31:37
R W Run
3.78 KB
2026-04-08 19:31:37
R W Run
2.92 KB
2026-04-08 19:31:39
R W Run
error_log
📄Dumper.php
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Yaml;
13
14use Symfony\Component\Yaml\Tag\TaggedValue;
15
16/**
17 * Dumper dumps PHP variables to YAML strings.
18 *
19 * @author Fabien Potencier <fabien@symfony.com>
20 *
21 * @final
22 */
23class Dumper
24{
25 /**
26 * The amount of spaces to use for indentation of nested nodes.
27 *
28 * @var int
29 */
30 protected $indentation;
31
32 public function __construct(int $indentation = 4)
33 {
34 if ($indentation < 1) {
35 throw new \InvalidArgumentException('The indentation must be greater than zero.');
36 }
37
38 $this->indentation = $indentation;
39 }
40
41 /**
42 * Dumps a PHP value to YAML.
43 *
44 * @param mixed $input The PHP value
45 * @param int $inline The level where you switch to inline YAML
46 * @param int $indent The level of indentation (used internally)
47 * @param int $flags A bit field of Yaml::DUMP_* constants to customize the dumped YAML string
48 *
49 * @return string The YAML representation of the PHP value
50 */
51 public function dump($input, int $inline = 0, int $indent = 0, int $flags = 0): string
52 {
53 $output = '';
54 $prefix = $indent ? str_repeat(' ', $indent) : '';
55 $dumpObjectAsInlineMap = true;
56
57 if (Yaml::DUMP_OBJECT_AS_MAP & $flags && ($input instanceof \ArrayObject || $input instanceof \stdClass)) {
58 $dumpObjectAsInlineMap = empty((array) $input);
59 }
60
61 if ($inline <= 0 || (!\is_array($input) && !$input instanceof TaggedValue && $dumpObjectAsInlineMap) || empty($input)) {
62 $output .= $prefix.Inline::dump($input, $flags);
63 } else {
64 $dumpAsMap = Inline::isHash($input);
65
66 foreach ($input as $key => $value) {
67 if ($inline >= 1 && Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value) && false !== strpos($value, "\n") && false === strpos($value, "\r")) {
68 // If the first line starts with a space character, the spec requires a blockIndicationIndicator
69 // http://www.yaml.org/spec/1.2/spec.html#id2793979
70 $blockIndentationIndicator = (' ' === substr($value, 0, 1)) ? (string) $this->indentation : '';
71 $output .= sprintf("%s%s%s |%s\n", $prefix, $dumpAsMap ? Inline::dump($key, $flags).':' : '-', '', $blockIndentationIndicator);
72
73 foreach (explode("\n", $value) as $row) {
74 $output .= sprintf("%s%s%s\n", $prefix, str_repeat(' ', $this->indentation), $row);
75 }
76
77 continue;
78 }
79
80 if ($value instanceof TaggedValue) {
81 $output .= sprintf('%s%s !%s', $prefix, $dumpAsMap ? Inline::dump($key, $flags).':' : '-', $value->getTag());
82
83 if ($inline >= 1 && Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value->getValue()) && false !== strpos($value->getValue(), "\n") && false === strpos($value->getValue(), "\r\n")) {
84 // If the first line starts with a space character, the spec requires a blockIndicationIndicator
85 // http://www.yaml.org/spec/1.2/spec.html#id2793979
86 $blockIndentationIndicator = (' ' === substr($value->getValue(), 0, 1)) ? (string) $this->indentation : '';
87 $output .= sprintf(" |%s\n", $blockIndentationIndicator);
88
89 foreach (explode("\n", $value->getValue()) as $row) {
90 $output .= sprintf("%s%s%s\n", $prefix, str_repeat(' ', $this->indentation), $row);
91 }
92
93 continue;
94 }
95
96 if ($inline - 1 <= 0 || null === $value->getValue() || is_scalar($value->getValue())) {
97 $output .= ' '.$this->dump($value->getValue(), $inline - 1, 0, $flags)."\n";
98 } else {
99 $output .= "\n";
100 $output .= $this->dump($value->getValue(), $inline - 1, $dumpAsMap ? $indent + $this->indentation : $indent + 2, $flags);
101 }
102
103 continue;
104 }
105
106 $dumpObjectAsInlineMap = true;
107
108 if (Yaml::DUMP_OBJECT_AS_MAP & $flags && ($value instanceof \ArrayObject || $value instanceof \stdClass)) {
109 $dumpObjectAsInlineMap = empty((array) $value);
110 }
111
112 $willBeInlined = $inline - 1 <= 0 || !\is_array($value) && $dumpObjectAsInlineMap || empty($value);
113
114 $output .= sprintf('%s%s%s%s',
115 $prefix,
116 $dumpAsMap ? Inline::dump($key, $flags).':' : '-',
117 $willBeInlined ? ' ' : "\n",
118 $this->dump($value, $inline - 1, $willBeInlined ? 0 : $indent + $this->indentation, $flags)
119 ).($willBeInlined ? "\n" : '');
120 }
121 }
122
123 return $output;
124 }
125}
126