Verzeichnisstruktur phpBB-3.3.16


Veröffentlicht
27.04.2026

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

Dumper.php

Zuletzt modifiziert: 01.05.2026, 11:26 - Dateigröße: 6.38 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\Tag\TaggedValue;
 015   
 016  /**
 017   * Dumper dumps PHP variables to YAML strings.
 018   *
 019   * @author Fabien Potencier <fabien@symfony.com>
 020   *
 021   * @final since version 3.4
 022   */
 023  class Dumper
 024  {
 025      /**
 026       * The amount of spaces to use for indentation of nested nodes.
 027       *
 028       * @var int
 029       */
 030      protected $indentation;
 031   
 032      /**
 033       * @param int $indentation
 034       */
 035      public function __construct($indentation = 4)
 036      {
 037          if ($indentation < 1) {
 038              throw new \InvalidArgumentException('The indentation must be greater than zero.');
 039          }
 040   
 041          $this->indentation = $indentation;
 042      }
 043   
 044      /**
 045       * Sets the indentation.
 046       *
 047       * @param int $num The amount of spaces to use for indentation of nested nodes
 048       *
 049       * @deprecated since version 3.1, to be removed in 4.0. Pass the indentation to the constructor instead.
 050       */
 051      public function setIndentation($num)
 052      {
 053          @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 3.1 and will be removed in 4.0. Pass the indentation to the constructor instead.', \E_USER_DEPRECATED);
 054   
 055          $this->indentation = (int) $num;
 056      }
 057   
 058      /**
 059       * Dumps a PHP value to YAML.
 060       *
 061       * @param mixed $input  The PHP value
 062       * @param int   $inline The level where you switch to inline YAML
 063       * @param int   $indent The level of indentation (used internally)
 064       * @param int   $flags  A bit field of Yaml::DUMP_* constants to customize the dumped YAML string
 065       *
 066       * @return string The YAML representation of the PHP value
 067       */
 068      public function dump($input, $inline = 0, $indent = 0, $flags = 0)
 069      {
 070          if (\is_bool($flags)) {
 071              @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 Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE flag instead.', \E_USER_DEPRECATED);
 072   
 073              if ($flags) {
 074                  $flags = Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE;
 075              } else {
 076                  $flags = 0;
 077              }
 078          }
 079   
 080          if (\func_num_args() >= 5) {
 081              @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 Yaml::DUMP_OBJECT flag instead.', \E_USER_DEPRECATED);
 082   
 083              if (func_get_arg(4)) {
 084                  $flags |= Yaml::DUMP_OBJECT;
 085              }
 086          }
 087   
 088          $output = '';
 089          $prefix = $indent ? str_repeat(' ', $indent) : '';
 090          $dumpObjectAsInlineMap = true;
 091   
 092          if (Yaml::DUMP_OBJECT_AS_MAP & $flags && ($input instanceof \ArrayObject || $input instanceof \stdClass)) {
 093              $dumpObjectAsInlineMap = empty((array) $input);
 094          }
 095   
 096          if ($inline <= 0 || (!\is_array($input) && !$input instanceof TaggedValue && $dumpObjectAsInlineMap) || empty($input)) {
 097              $output .= $prefix.Inline::dump($input, $flags);
 098          } else {
 099              $dumpAsMap = Inline::isHash($input);
 100   
 101              foreach ($input as $key => $value) {
 102                  if ($inline >= 1 && Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value) && false !== strpos($value, "\n") && false === strpos($value, "\r")) {
 103                      // If the first line starts with a space character, the spec requires a blockIndicationIndicator
 104                      // http://www.yaml.org/spec/1.2/spec.html#id2793979
 105                      $blockIndentationIndicator = (' ' === substr($value, 0, 1)) ? (string) $this->indentation : '';
 106                      $output .= sprintf("%s%s%s |%s\n", $prefix, $dumpAsMap ? Inline::dump($key, $flags).':' : '-', '', $blockIndentationIndicator);
 107   
 108                      foreach (explode("\n", $value) as $row) {
 109                          $output .= sprintf("%s%s%s\n", $prefix, str_repeat(' ', $this->indentation), $row);
 110                      }
 111   
 112                      continue;
 113                  }
 114   
 115                  if ($value instanceof TaggedValue) {
 116                      $output .= sprintf('%s%s !%s', $prefix, $dumpAsMap ? Inline::dump($key, $flags).':' : '-', $value->getTag());
 117   
 118                      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")) {
 119                          // If the first line starts with a space character, the spec requires a blockIndicationIndicator
 120                          // http://www.yaml.org/spec/1.2/spec.html#id2793979
 121                          $blockIndentationIndicator = (' ' === substr($value->getValue(), 0, 1)) ? (string) $this->indentation : '';
 122                          $output .= sprintf(" |%s\n", $blockIndentationIndicator);
 123   
 124                          foreach (explode("\n", $value->getValue()) as $row) {
 125                              $output .= sprintf("%s%s%s\n", $prefix, str_repeat(' ', $this->indentation), $row);
 126                          }
 127   
 128                          continue;
 129                      }
 130   
 131                      if ($inline - 1 <= 0 || null === $value->getValue() || is_scalar($value->getValue())) {
 132                          $output .= ' '.$this->dump($value->getValue(), $inline - 1, 0, $flags)."\n";
 133                      } else {
 134                          $output .= "\n";
 135                          $output .= $this->dump($value->getValue(), $inline - 1, $dumpAsMap ? $indent + $this->indentation : $indent + 2, $flags);
 136                      }
 137   
 138                      continue;
 139                  }
 140   
 141                  $dumpObjectAsInlineMap = true;
 142   
 143                  if (Yaml::DUMP_OBJECT_AS_MAP & $flags && ($value instanceof \ArrayObject || $value instanceof \stdClass)) {
 144                      $dumpObjectAsInlineMap = empty((array) $value);
 145                  }
 146   
 147                  $willBeInlined = $inline - 1 <= 0 || !\is_array($value) && $dumpObjectAsInlineMap || empty($value);
 148   
 149                  $output .= sprintf('%s%s%s%s',
 150                      $prefix,
 151                      $dumpAsMap ? Inline::dump($key, $flags).':' : '-',
 152                      $willBeInlined ? ' ' : "\n",
 153                      $this->dump($value, $inline - 1, $willBeInlined ? 0 : $indent + $this->indentation, $flags)
 154                  ).($willBeInlined ? "\n" : '');
 155              }
 156          }
 157   
 158          return $output;
 159      }
 160  }
 161