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

FormatterHelper.php

Zuletzt modifiziert: 09.10.2024, 12:58 - Dateigröße: 2.18 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\Console\Helper;
13   
14  use Symfony\Component\Console\Formatter\OutputFormatter;
15   
16  /**
17   * The Formatter class provides helpers to format messages.
18   *
19   * @author Fabien Potencier <fabien@symfony.com>
20   */
21  class FormatterHelper extends Helper
22  {
23      /**
24       * Formats a message within a section.
25       *
26       * @param string $section The section name
27       * @param string $message The message
28       * @param string $style   The style to apply to the section
29       *
30       * @return string The format section
31       */
32      public function formatSection($section, $message, $style = 'info')
33      {
34          return sprintf('<%s>[%s]</%s> %s', $style, $section, $style, $message);
35      }
36   
37      /**
38       * Formats a message as a block of text.
39       *
40       * @param string|array $messages The message to write in the block
41       * @param string       $style    The style to apply to the whole block
42       * @param bool         $large    Whether to return a large block
43       *
44       * @return string The formatter message
45       */
46      public function formatBlock($messages, $style, $large = false)
47      {
48          $messages = (array) $messages;
49   
50          $len = 0;
51          $lines = array();
52          foreach ($messages as $message) {
53              $message = OutputFormatter::escape($message);
54              $lines[] = sprintf($large ? '  %s  ' : ' %s ', $message);
55              $len = max($this->strlen($message) + ($large ? 4 : 2), $len);
56          }
57   
58          $messages = $large ? array(str_repeat(' ', $len)) : array();
59          foreach ($lines as $line) {
60              $messages[] = $line.str_repeat(' ', $len - $this->strlen($line));
61          }
62          if ($large) {
63              $messages[] = str_repeat(' ', $len);
64          }
65   
66          foreach ($messages as &$message) {
67              $message = sprintf('<%s>%s</%s>', $style, $message, $style);
68          }
69   
70          return implode("\n", $messages);
71      }
72   
73      /**
74       * {@inheritdoc}
75       */
76      public function getName()
77      {
78          return 'formatter';
79      }
80  }
81