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

Output.php

Zuletzt modifiziert: 09.10.2024, 12:58 - Dateigröße: 3.67 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   * @api
031   */
032  abstract class Output implements OutputInterface
033  {
034      private $verbosity;
035      private $formatter;
036   
037      /**
038       * Constructor.
039       *
040       * @param int                           $verbosity The verbosity level (one of the VERBOSITY constants in OutputInterface)
041       * @param bool                          $decorated Whether to decorate messages
042       * @param OutputFormatterInterface|null $formatter Output formatter instance (null to use default OutputFormatter)
043       *
044       * @api
045       */
046      public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = false, OutputFormatterInterface $formatter = null)
047      {
048          $this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
049          $this->formatter = null === $formatter ? new OutputFormatter() : $formatter;
050          $this->formatter->setDecorated($decorated);
051      }
052   
053      /**
054       * {@inheritdoc}
055       */
056      public function setFormatter(OutputFormatterInterface $formatter)
057      {
058          $this->formatter = $formatter;
059      }
060   
061      /**
062       * {@inheritdoc}
063       */
064      public function getFormatter()
065      {
066          return $this->formatter;
067      }
068   
069      /**
070       * {@inheritdoc}
071       */
072      public function setDecorated($decorated)
073      {
074          $this->formatter->setDecorated($decorated);
075      }
076   
077      /**
078       * {@inheritdoc}
079       */
080      public function isDecorated()
081      {
082          return $this->formatter->isDecorated();
083      }
084   
085      /**
086       * {@inheritdoc}
087       */
088      public function setVerbosity($level)
089      {
090          $this->verbosity = (int) $level;
091      }
092   
093      /**
094       * {@inheritdoc}
095       */
096      public function getVerbosity()
097      {
098          return $this->verbosity;
099      }
100   
101      /**
102       * {@inheritdoc}
103       */
104      public function writeln($messages, $type = self::OUTPUT_NORMAL)
105      {
106          $this->write($messages, true, $type);
107      }
108   
109      /**
110       * {@inheritdoc}
111       */
112      public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
113      {
114          if (self::VERBOSITY_QUIET === $this->verbosity) {
115              return;
116          }
117   
118          $messages = (array) $messages;
119   
120          foreach ($messages as $message) {
121              switch ($type) {
122                  case OutputInterface::OUTPUT_NORMAL:
123                      $message = $this->formatter->format($message);
124                      break;
125                  case OutputInterface::OUTPUT_RAW:
126                      break;
127                  case OutputInterface::OUTPUT_PLAIN:
128                      $message = strip_tags($this->formatter->format($message));
129                      break;
130                  default:
131                      throw new \InvalidArgumentException(sprintf('Unknown output type given (%s)', $type));
132              }
133   
134              $this->doWrite($message, $newline);
135          }
136      }
137   
138      /**
139       * Writes a message to the output.
140       *
141       * @param string  $message A message to write to the output
142       * @param bool    $newline Whether to add a newline or not
143       */
144      abstract protected function doWrite($message, $newline);
145  }
146