PluginProbe
WindPress – Tailwind CSS integration for WordPress / 3.2.90
WindPress – Tailwind CSS integration for WordPress v3.2.90
3.2.90 3.2.89 3.2.88 3.2.87 3.2.86 3.2.85 3.2.84 3.2.83 3.2.82 3.2.81 trunk 3.0.0 3.0.1 3.0.10 3.0.11 3.0.12 3.0.13 3.0.14 3.0.15 3.0.16 3.0.17 3.0.2 3.0.3 3.0.4 3.0.5 All 144 releases
windpress / vendor / symfony / yaml / Yaml.php

Yaml.php in WindPress – Tailwind CSS integration for WordPress 3.2.90, at vendor/symfony/yaml/Yaml.php

98 lines 3.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 namespace WindPressDeps\Symfony\Component\Yaml;
12
13 use WindPressDeps\Symfony\Component\Yaml\Exception\ParseException;
14 /**
15 * Yaml offers convenience methods to load and dump YAML.
16 *
17 * @author Fabien Potencier <fabien@symfony.com>
18 *
19 * @final
20 */
21 class Yaml
22 {
23 public const DUMP_OBJECT = 1;
24 public const PARSE_EXCEPTION_ON_INVALID_TYPE = 2;
25 public const PARSE_OBJECT = 4;
26 public const PARSE_OBJECT_FOR_MAP = 8;
27 public const DUMP_EXCEPTION_ON_INVALID_TYPE = 16;
28 public const PARSE_DATETIME = 32;
29 public const DUMP_OBJECT_AS_MAP = 64;
30 public const DUMP_MULTI_LINE_LITERAL_BLOCK = 128;
31 public const PARSE_CONSTANT = 256;
32 public const PARSE_CUSTOM_TAGS = 512;
33 public const DUMP_EMPTY_ARRAY_AS_SEQUENCE = 1024;
34 public const DUMP_NULL_AS_TILDE = 2048;
35 public const PARSE_EXCEPTION_ON_ALIAS = 8192;
36 /**
37 * Parses a YAML file into a PHP value.
38 *
39 * Usage:
40 *
41 * $array = Yaml::parseFile('config.yml');
42 * print_r($array);
43 *
44 * @param string $filename The path to the YAML file to be parsed
45 * @param int $flags A bit field of PARSE_* constants to customize the YAML parser behavior
46 * @param int $maxNestingLevel The maximum nesting depth for nested YAML blocks
47 * @param int $maxAliasesForCollections The maximum number of collection aliases to resolve
48 *
49 * @return mixed
50 *
51 * @throws ParseException If the file could not be read or the YAML is not valid
52 */
53 public static function parseFile(string $filename, int $flags = 0, int $maxNestingLevel = Parser::DEFAULT_MAX_NESTING_LEVEL, int $maxAliasesForCollections = Parser::DEFAULT_MAX_ALIASES_FOR_COLLECTIONS)
54 {
55 $yaml = new Parser($maxNestingLevel, $maxAliasesForCollections);
56 return $yaml->parseFile($filename, $flags);
57 }
58 /**
59 * Parses YAML into a PHP value.
60 *
61 * Usage:
62 * <code>
63 * $array = Yaml::parse(file_get_contents('config.yml'));
64 * print_r($array);
65 * </code>
66 *
67 * @param string $input A string containing YAML
68 * @param int $flags A bit field of PARSE_* constants to customize the YAML parser behavior
69 * @param int $maxNestingLevel The maximum nesting depth for nested YAML blocks
70 * @param int $maxAliasesForCollections The maximum number of collection aliases to resolve
71 *
72 * @return mixed
73 *
74 * @throws ParseException If the YAML is not valid
75 */
76 public static function parse(string $input, int $flags = 0, int $maxNestingLevel = Parser::DEFAULT_MAX_NESTING_LEVEL, int $maxAliasesForCollections = Parser::DEFAULT_MAX_ALIASES_FOR_COLLECTIONS)
77 {
78 $yaml = new Parser($maxNestingLevel, $maxAliasesForCollections);
79 return $yaml->parse($input, $flags);
80 }
81 /**
82 * Dumps a PHP value to a YAML string.
83 *
84 * The dump method, when supplied with an array, will do its best
85 * to convert the array into friendly YAML.
86 *
87 * @param mixed $input The PHP value
88 * @param int $inline The level where you switch to inline YAML
89 * @param int $indent The amount of spaces to use for indentation of nested nodes
90 * @param int $flags A bit field of DUMP_* constants to customize the dumped YAML string
91 */
92 public static function dump($input, int $inline = 2, int $indent = 4, int $flags = 0): string
93 {
94 $yaml = new Dumper($indent);
95 return $yaml->dump($input, $inline, 0, $flags);
96 }
97 }
98