123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- <?php
- namespace Symfony\Component\Yaml;
- use Symfony\Component\Yaml\Exception\ParseException;
- class Yaml
- {
- const DUMP_OBJECT = 1;
- const PARSE_EXCEPTION_ON_INVALID_TYPE = 2;
- const PARSE_OBJECT = 4;
- const PARSE_OBJECT_FOR_MAP = 8;
- const DUMP_EXCEPTION_ON_INVALID_TYPE = 16;
- const PARSE_DATETIME = 32;
- const DUMP_OBJECT_AS_MAP = 64;
- const DUMP_MULTI_LINE_LITERAL_BLOCK = 128;
- const PARSE_CONSTANT = 256;
- const PARSE_CUSTOM_TAGS = 512;
- const DUMP_EMPTY_ARRAY_AS_SEQUENCE = 1024;
-
- public static function parseFile(string $filename, int $flags = 0)
- {
- $yaml = new Parser();
- return $yaml->parseFile($filename, $flags);
- }
-
- public static function parse(string $input, int $flags = 0)
- {
- $yaml = new Parser();
- return $yaml->parse($input, $flags);
- }
-
- public static function dump($input, int $inline = 2, int $indent = 4, int $flags = 0): string
- {
- $yaml = new Dumper($indent);
- return $yaml->dump($input, $inline, 0, $flags);
- }
- }
|