Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

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

Output.php

Zuletzt modifiziert: 09.10.2024, 12:56 - Dateigröße: 4.40 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\Console\Output;
 013   
 014  use Symfony\Component\Console\Formatter\OutputFormatterInterface;
 015  use Symfony\Component\Console\Formatter\OutputFormatter;
 016   
 017  /**
 018   * Base class for output classes.
 019   *
 020   * There are five levels of verbosity:
 021   *
 022   *  * normal: no option passed (normal output)
 023   *  * verbose: -v (more output)
 024   *  * very verbose: -vv (highly extended output)
 025   *  * debug: -vvv (all debug output)
 026   *  * quiet: -q (no output)
 027   *
 028   * @author Fabien Potencier <fabien@symfony.com>
 029   */
 030  abstract class Output implements OutputInterface
 031  {
 032      private $verbosity;
 033      private $formatter;
 034   
 035      /**
 036       * Constructor.
 037       *
 038       * @param int                           $verbosity The verbosity level (one of the VERBOSITY constants in OutputInterface)
 039       * @param bool                          $decorated Whether to decorate messages
 040       * @param OutputFormatterInterface|null $formatter Output formatter instance (null to use default OutputFormatter)
 041       */
 042      public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = false, OutputFormatterInterface $formatter = null)
 043      {
 044          $this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
 045          $this->formatter = $formatter ?: new OutputFormatter();
 046          $this->formatter->setDecorated($decorated);
 047      }
 048   
 049      /**
 050       * {@inheritdoc}
 051       */
 052      public function setFormatter(OutputFormatterInterface $formatter)
 053      {
 054          $this->formatter = $formatter;
 055      }
 056   
 057      /**
 058       * {@inheritdoc}
 059       */
 060      public function getFormatter()
 061      {
 062          return $this->formatter;
 063      }
 064   
 065      /**
 066       * {@inheritdoc}
 067       */
 068      public function setDecorated($decorated)
 069      {
 070          $this->formatter->setDecorated($decorated);
 071      }
 072   
 073      /**
 074       * {@inheritdoc}
 075       */
 076      public function isDecorated()
 077      {
 078          return $this->formatter->isDecorated();
 079      }
 080   
 081      /**
 082       * {@inheritdoc}
 083       */
 084      public function setVerbosity($level)
 085      {
 086          $this->verbosity = (int) $level;
 087      }
 088   
 089      /**
 090       * {@inheritdoc}
 091       */
 092      public function getVerbosity()
 093      {
 094          return $this->verbosity;
 095      }
 096   
 097      /**
 098       * {@inheritdoc}
 099       */
 100      public function isQuiet()
 101      {
 102          return self::VERBOSITY_QUIET === $this->verbosity;
 103      }
 104   
 105      /**
 106       * {@inheritdoc}
 107       */
 108      public function isVerbose()
 109      {
 110          return self::VERBOSITY_VERBOSE <= $this->verbosity;
 111      }
 112   
 113      /**
 114       * {@inheritdoc}
 115       */
 116      public function isVeryVerbose()
 117      {
 118          return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity;
 119      }
 120   
 121      /**
 122       * {@inheritdoc}
 123       */
 124      public function isDebug()
 125      {
 126          return self::VERBOSITY_DEBUG <= $this->verbosity;
 127      }
 128   
 129      /**
 130       * {@inheritdoc}
 131       */
 132      public function writeln($messages, $options = self::OUTPUT_NORMAL)
 133      {
 134          $this->write($messages, true, $options);
 135      }
 136   
 137      /**
 138       * {@inheritdoc}
 139       */
 140      public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
 141      {
 142          $messages = (array) $messages;
 143   
 144          $types = self::OUTPUT_NORMAL | self::OUTPUT_RAW | self::OUTPUT_PLAIN;
 145          $type = $types & $options ?: self::OUTPUT_NORMAL;
 146   
 147          $verbosities = self::VERBOSITY_QUIET | self::VERBOSITY_NORMAL | self::VERBOSITY_VERBOSE | self::VERBOSITY_VERY_VERBOSE | self::VERBOSITY_DEBUG;
 148          $verbosity = $verbosities & $options ?: self::VERBOSITY_NORMAL;
 149   
 150          if ($verbosity > $this->getVerbosity()) {
 151              return;
 152          }
 153   
 154          foreach ($messages as $message) {
 155              switch ($type) {
 156                  case OutputInterface::OUTPUT_NORMAL:
 157                      $message = $this->formatter->format($message);
 158                      break;
 159                  case OutputInterface::OUTPUT_RAW:
 160                      break;
 161                  case OutputInterface::OUTPUT_PLAIN:
 162                      $message = strip_tags($this->formatter->format($message));
 163                      break;
 164              }
 165   
 166              $this->doWrite($message, $newline);
 167          }
 168      }
 169   
 170      /**
 171       * Writes a message to the output.
 172       *
 173       * @param string $message A message to write to the output
 174       * @param bool   $newline Whether to add a newline or not
 175       */
 176      abstract protected function doWrite($message, $newline);
 177  }
 178