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

TableHelper.php

Zuletzt modifiziert: 09.10.2024, 12:56 - Dateigröße: 6.11 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\Helper;
013   
014  use Symfony\Component\Console\Output\OutputInterface;
015  use Symfony\Component\Console\Output\NullOutput;
016  use Symfony\Component\Console\Exception\InvalidArgumentException;
017   
018  /**
019   * Provides helpers to display table output.
020   *
021   * @author Саша Стаменковић <umpirsky@gmail.com>
022   * @author Fabien Potencier <fabien@symfony.com>
023   *
024   * @deprecated since version 2.5, to be removed in 3.0
025   *             Use {@link Table} instead.
026   */
027  class TableHelper extends Helper
028  {
029      const LAYOUT_DEFAULT = 0;
030      const LAYOUT_BORDERLESS = 1;
031      const LAYOUT_COMPACT = 2;
032   
033      /**
034       * @var Table
035       */
036      private $table;
037   
038      public function __construct($triggerDeprecationError = true)
039      {
040          if ($triggerDeprecationError) {
041              @trigger_error('The '.__CLASS__.' class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\Table class instead.', E_USER_DEPRECATED);
042          }
043   
044          $this->table = new Table(new NullOutput());
045      }
046   
047      /**
048       * Sets table layout type.
049       *
050       * @param int $layout self::LAYOUT_*
051       *
052       * @return TableHelper
053       *
054       * @throws InvalidArgumentException when the table layout is not known
055       */
056      public function setLayout($layout)
057      {
058          switch ($layout) {
059              case self::LAYOUT_BORDERLESS:
060                  $this->table->setStyle('borderless');
061                  break;
062   
063              case self::LAYOUT_COMPACT:
064                  $this->table->setStyle('compact');
065                  break;
066   
067              case self::LAYOUT_DEFAULT:
068                  $this->table->setStyle('default');
069                  break;
070   
071              default:
072                  throw new InvalidArgumentException(sprintf('Invalid table layout "%s".', $layout));
073          }
074   
075          return $this;
076      }
077   
078      public function setHeaders(array $headers)
079      {
080          $this->table->setHeaders($headers);
081   
082          return $this;
083      }
084   
085      public function setRows(array $rows)
086      {
087          $this->table->setRows($rows);
088   
089          return $this;
090      }
091   
092      public function addRows(array $rows)
093      {
094          $this->table->addRows($rows);
095   
096          return $this;
097      }
098   
099      public function addRow(array $row)
100      {
101          $this->table->addRow($row);
102   
103          return $this;
104      }
105   
106      public function setRow($column, array $row)
107      {
108          $this->table->setRow($column, $row);
109   
110          return $this;
111      }
112   
113      /**
114       * Sets padding character, used for cell padding.
115       *
116       * @param string $paddingChar
117       *
118       * @return TableHelper
119       */
120      public function setPaddingChar($paddingChar)
121      {
122          $this->table->getStyle()->setPaddingChar($paddingChar);
123   
124          return $this;
125      }
126   
127      /**
128       * Sets horizontal border character.
129       *
130       * @param string $horizontalBorderChar
131       *
132       * @return TableHelper
133       */
134      public function setHorizontalBorderChar($horizontalBorderChar)
135      {
136          $this->table->getStyle()->setHorizontalBorderChar($horizontalBorderChar);
137   
138          return $this;
139      }
140   
141      /**
142       * Sets vertical border character.
143       *
144       * @param string $verticalBorderChar
145       *
146       * @return TableHelper
147       */
148      public function setVerticalBorderChar($verticalBorderChar)
149      {
150          $this->table->getStyle()->setVerticalBorderChar($verticalBorderChar);
151   
152          return $this;
153      }
154   
155      /**
156       * Sets crossing character.
157       *
158       * @param string $crossingChar
159       *
160       * @return TableHelper
161       */
162      public function setCrossingChar($crossingChar)
163      {
164          $this->table->getStyle()->setCrossingChar($crossingChar);
165   
166          return $this;
167      }
168   
169      /**
170       * Sets header cell format.
171       *
172       * @param string $cellHeaderFormat
173       *
174       * @return TableHelper
175       */
176      public function setCellHeaderFormat($cellHeaderFormat)
177      {
178          $this->table->getStyle()->setCellHeaderFormat($cellHeaderFormat);
179   
180          return $this;
181      }
182   
183      /**
184       * Sets row cell format.
185       *
186       * @param string $cellRowFormat
187       *
188       * @return TableHelper
189       */
190      public function setCellRowFormat($cellRowFormat)
191      {
192          $this->table->getStyle()->setCellHeaderFormat($cellRowFormat);
193   
194          return $this;
195      }
196   
197      /**
198       * Sets row cell content format.
199       *
200       * @param string $cellRowContentFormat
201       *
202       * @return TableHelper
203       */
204      public function setCellRowContentFormat($cellRowContentFormat)
205      {
206          $this->table->getStyle()->setCellRowContentFormat($cellRowContentFormat);
207   
208          return $this;
209      }
210   
211      /**
212       * Sets table border format.
213       *
214       * @param string $borderFormat
215       *
216       * @return TableHelper
217       */
218      public function setBorderFormat($borderFormat)
219      {
220          $this->table->getStyle()->setBorderFormat($borderFormat);
221   
222          return $this;
223      }
224   
225      /**
226       * Sets cell padding type.
227       *
228       * @param int $padType STR_PAD_*
229       *
230       * @return TableHelper
231       */
232      public function setPadType($padType)
233      {
234          $this->table->getStyle()->setPadType($padType);
235   
236          return $this;
237      }
238   
239      /**
240       * Renders table to output.
241       *
242       * Example:
243       * +---------------+-----------------------+------------------+
244       * | ISBN          | Title                 | Author           |
245       * +---------------+-----------------------+------------------+
246       * | 99921-58-10-7 | Divine Comedy         | Dante Alighieri  |
247       * | 9971-5-0210-0 | A Tale of Two Cities  | Charles Dickens  |
248       * | 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien |
249       * +---------------+-----------------------+------------------+
250       *
251       * @param OutputInterface $output
252       */
253      public function render(OutputInterface $output)
254      {
255          $p = new \ReflectionProperty($this->table, 'output');
256          $p->setAccessible(true);
257          $p->setValue($this->table, $output);
258   
259          $this->table->render();
260      }
261   
262      /**
263       * {@inheritdoc}
264       */
265      public function getName()
266      {
267          return 'table';
268      }
269  }
270