34 throw new \InvalidArgumentException(
'The indentation must be greater than zero.');
47 @trigger_error(
'The '.__METHOD__.
' method is deprecated since version 3.1 and will be removed in 4.0. Pass the indentation to the constructor instead.', E_USER_DEPRECATED);
49 $this->indentation = (int) $num;
62 public function dump($input, $inline = 0, $indent = 0, $flags = 0)
64 if (is_bool($flags)) {
65 @trigger_error(
'Passing a boolean flag to toggle exception handling is deprecated since version 3.1 and will be removed in 4.0. Use the Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE flag instead.', E_USER_DEPRECATED);
74 if (func_num_args() >= 5) {
75 @trigger_error(
'Passing a boolean flag to toggle object support is deprecated since version 3.1 and will be removed in 4.0. Use the Yaml::DUMP_OBJECT flag instead.', E_USER_DEPRECATED);
77 if (func_get_arg(4)) {
83 $prefix = $indent ? str_repeat(
' ', $indent) :
'';
85 if ($inline <= 0 || !is_array($input) || empty($input)) {
86 $output .= $prefix.Inline::dump($input, $flags);
90 foreach ($input as
$key => $value) {
94 foreach (preg_split(
'/\n|\r\n/', $value) as
$row) {
95 $output .= sprintf(
"%s%s%s\n", $prefix, str_repeat(
' ', $this->indentation), $row);
101 $willBeInlined = $inline - 1 <= 0 || !is_array($value) || empty($value);
106 $willBeInlined ?
' ' :
"\n",
107 $this->
dump($value, $inline - 1, $willBeInlined ? 0 : $indent + $this->indentation, $flags)
108 ).($willBeInlined ?
"\n" :
'');
const DUMP_MULTI_LINE_LITERAL_BLOCK
dump($input, $inline=0, $indent=0, $flags=0)
Dumps a PHP value to YAML.
setIndentation($num)
Sets the indentation.
static isHash(array $value)
Check if given array is hash or just normal indexed array.
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
static dump($value, $flags=0)
Dumps a given PHP variable to a YAML string.
__construct($indentation=4)
Dumper dumps PHP variables to YAML strings.
const DUMP_EXCEPTION_ON_INVALID_TYPE