Verzeichnisstruktur phpBB-3.3.15


Veröffentlicht
28.08.2024

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

Yaml.php

Zuletzt modifiziert: 02.04.2025, 15:02 - Dateigröße: 4.83 KiB


001  <?php
002   
003  /*
004   * This file is part of the Symfony package.
005   *
006   * (c) Fabien Potencier <fabien@symfony.com>
007   *
008   * For the full copyright and license information, please view the LICENSE
009   * file that was distributed with this source code.
010   */
011   
012  namespace Symfony\Component\Yaml;
013   
014  use Symfony\Component\Yaml\Exception\ParseException;
015   
016  /**
017   * Yaml offers convenience methods to load and dump YAML.
018   *
019   * @author Fabien Potencier <fabien@symfony.com>
020   *
021   * @final since version 3.4
022   */
023  class Yaml
024  {
025      const DUMP_OBJECT = 1;
026      const PARSE_EXCEPTION_ON_INVALID_TYPE = 2;
027      const PARSE_OBJECT = 4;
028      const PARSE_OBJECT_FOR_MAP = 8;
029      const DUMP_EXCEPTION_ON_INVALID_TYPE = 16;
030      const PARSE_DATETIME = 32;
031      const DUMP_OBJECT_AS_MAP = 64;
032      const DUMP_MULTI_LINE_LITERAL_BLOCK = 128;
033      const PARSE_CONSTANT = 256;
034      const PARSE_CUSTOM_TAGS = 512;
035      const DUMP_EMPTY_ARRAY_AS_SEQUENCE = 1024;
036   
037      /**
038       * @deprecated since version 3.4, to be removed in 4.0. Quote your evaluable keys instead.
039       */
040      const PARSE_KEYS_AS_STRINGS = 2048;
041   
042      /**
043       * Parses a YAML file into a PHP value.
044       *
045       * Usage:
046       *
047       *     $array = Yaml::parseFile('config.yml');
048       *     print_r($array);
049       *
050       * @param string $filename The path to the YAML file to be parsed
051       * @param int    $flags    A bit field of PARSE_* constants to customize the YAML parser behavior
052       *
053       * @return mixed The YAML converted to a PHP value
054       *
055       * @throws ParseException If the file could not be read or the YAML is not valid
056       */
057      public static function parseFile($filename, $flags = 0)
058      {
059          $yaml = new Parser();
060   
061          return $yaml->parseFile($filename, $flags);
062      }
063   
064      /**
065       * Parses YAML into a PHP value.
066       *
067       *  Usage:
068       *  <code>
069       *   $array = Yaml::parse(file_get_contents('config.yml'));
070       *   print_r($array);
071       *  </code>
072       *
073       * @param string $input A string containing YAML
074       * @param int    $flags A bit field of PARSE_* constants to customize the YAML parser behavior
075       *
076       * @return mixed The YAML converted to a PHP value
077       *
078       * @throws ParseException If the YAML is not valid
079       */
080      public static function parse($input, $flags = 0)
081      {
082          if (\is_bool($flags)) {
083              @trigger_error('Passing a boolean flag to toggle exception handling is deprecated since Symfony 3.1 and will be removed in 4.0. Use the PARSE_EXCEPTION_ON_INVALID_TYPE flag instead.', \E_USER_DEPRECATED);
084   
085              if ($flags) {
086                  $flags = self::PARSE_EXCEPTION_ON_INVALID_TYPE;
087              } else {
088                  $flags = 0;
089              }
090          }
091   
092          if (\func_num_args() >= 3) {
093              @trigger_error('Passing a boolean flag to toggle object support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the PARSE_OBJECT flag instead.', \E_USER_DEPRECATED);
094   
095              if (func_get_arg(2)) {
096                  $flags |= self::PARSE_OBJECT;
097              }
098          }
099   
100          if (\func_num_args() >= 4) {
101              @trigger_error('Passing a boolean flag to toggle object for map support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::PARSE_OBJECT_FOR_MAP flag instead.', \E_USER_DEPRECATED);
102   
103              if (func_get_arg(3)) {
104                  $flags |= self::PARSE_OBJECT_FOR_MAP;
105              }
106          }
107   
108          $yaml = new Parser();
109   
110          return $yaml->parse($input, $flags);
111      }
112   
113      /**
114       * Dumps a PHP value to a YAML string.
115       *
116       * The dump method, when supplied with an array, will do its best
117       * to convert the array into friendly YAML.
118       *
119       * @param mixed $input  The PHP value
120       * @param int   $inline The level where you switch to inline YAML
121       * @param int   $indent The amount of spaces to use for indentation of nested nodes
122       * @param int   $flags  A bit field of DUMP_* constants to customize the dumped YAML string
123       *
124       * @return string A YAML string representing the original PHP value
125       */
126      public static function dump($input, $inline = 2, $indent = 4, $flags = 0)
127      {
128          if (\is_bool($flags)) {
129              @trigger_error('Passing a boolean flag to toggle exception handling is deprecated since Symfony 3.1 and will be removed in 4.0. Use the DUMP_EXCEPTION_ON_INVALID_TYPE flag instead.', \E_USER_DEPRECATED);
130   
131              if ($flags) {
132                  $flags = self::DUMP_EXCEPTION_ON_INVALID_TYPE;
133              } else {
134                  $flags = 0;
135              }
136          }
137   
138          if (\func_num_args() >= 5) {
139              @trigger_error('Passing a boolean flag to toggle object support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the DUMP_OBJECT flag instead.', \E_USER_DEPRECATED);
140   
141              if (func_get_arg(4)) {
142                  $flags |= self::DUMP_OBJECT;
143              }
144          }
145   
146          $yaml = new Dumper($indent);
147   
148          return $yaml->dump($input, $inline, 0, $flags);
149      }
150  }
151