Verzeichnisstruktur phpBB-3.1.0


Veröffentlicht
27.10.2014

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: 09.10.2024, 12:58 - Dateigröße: 2.39 KiB


 01  <?php
 02   
 03  /*
 04   * This file is part of the Symfony package.
 05   *
 06   * (c) Fabien Potencier <fabien@symfony.com>
 07   *
 08   * For the full copyright and license information, please view the LICENSE
 09   * file that was distributed with this source code.
 10   */
 11   
 12  namespace Symfony\Component\Yaml;
 13   
 14  /**
 15   * Dumper dumps PHP variables to YAML strings.
 16   *
 17   * @author Fabien Potencier <fabien@symfony.com>
 18   */
 19  class Dumper
 20  {
 21      /**
 22       * The amount of spaces to use for indentation of nested nodes.
 23       *
 24       * @var int
 25       */
 26      protected $indentation = 4;
 27   
 28      /**
 29       * Sets the indentation.
 30       *
 31       * @param int     $num The amount of spaces to use for indentation of nested nodes.
 32       */
 33      public function setIndentation($num)
 34      {
 35          $this->indentation = (int) $num;
 36      }
 37   
 38      /**
 39       * Dumps a PHP value to YAML.
 40       *
 41       * @param mixed   $input                  The PHP value
 42       * @param int     $inline                 The level where you switch to inline YAML
 43       * @param int     $indent                 The level of indentation (used internally)
 44       * @param bool    $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
 45       * @param bool    $objectSupport          true if object support is enabled, false otherwise
 46       *
 47       * @return string  The YAML representation of the PHP value
 48       */
 49      public function dump($input, $inline = 0, $indent = 0, $exceptionOnInvalidType = false, $objectSupport = false)
 50      {
 51          $output = '';
 52          $prefix = $indent ? str_repeat(' ', $indent) : '';
 53   
 54          if ($inline <= 0 || !is_array($input) || empty($input)) {
 55              $output .= $prefix.Inline::dump($input, $exceptionOnInvalidType, $objectSupport);
 56          } else {
 57              $isAHash = array_keys($input) !== range(0, count($input) - 1);
 58   
 59              foreach ($input as $key => $value) {
 60                  $willBeInlined = $inline - 1 <= 0 || !is_array($value) || empty($value);
 61   
 62                  $output .= sprintf('%s%s%s%s',
 63                      $prefix,
 64                      $isAHash ? Inline::dump($key, $exceptionOnInvalidType, $objectSupport).':' : '-',
 65                      $willBeInlined ? ' ' : "\n",
 66                      $this->dump($value, $inline - 1, $willBeInlined ? 0 : $indent + $this->indentation, $exceptionOnInvalidType, $objectSupport)
 67                  ).($willBeInlined ? "\n" : '');
 68              }
 69          }
 70   
 71          return $output;
 72      }
 73  }
 74