Verzeichnisstruktur phpBB-3.3.16


Veröffentlicht
27.04.2026

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

PrintableAscii.php

Zuletzt modifiziert: 01.05.2026, 11:27 - Dateigröße: 1.49 KiB


 01  <?php declare(strict_types=1);
 02   
 03  /**
 04  * @package   s9e\RegexpBuilder
 05  * @copyright Copyright (c) 2016-2022 The s9e authors
 06  * @license   http://www.opensource.org/licenses/mit-license.php The MIT License
 07  */
 08  namespace s9e\RegexpBuilder\Output;
 09   
 10  use function chr, sprintf;
 11   
 12  abstract class PrintableAscii extends BaseImplementation
 13  {
 14      /**
 15      * @var string 'x' for lowercase hexadecimal symbols, 'X' for uppercase
 16      */
 17      protected $hexCase;
 18   
 19      /**
 20      * {@inheritdoc}
 21      */
 22      public function __construct(array $options = [])
 23      {
 24          $this->hexCase = (isset($options['case']) && $options['case'] === 'lower') ? 'x' : 'X';
 25      }
 26   
 27      /**
 28      * Escape given ASCII codepoint
 29      *
 30      * @param  integer $cp
 31      * @return string
 32      */
 33      protected function escapeAscii(int $cp): string
 34      {
 35          return '\\x' . sprintf('%02' . $this->hexCase, $cp);
 36      }
 37   
 38      /**
 39      * Escape given control code
 40      *
 41      * @param  integer $cp
 42      * @return string
 43      */
 44      protected function escapeControlCode(int $cp): string
 45      {
 46          $table = [9 => '\\t', 10 => '\\n', 13 => '\\r'];
 47   
 48          return $table[$cp] ?? $this->escapeAscii($cp);
 49      }
 50   
 51      /**
 52      * Output the representation of a unicode character
 53      *
 54      * @param  integer $cp Unicode codepoint
 55      * @return string
 56      */
 57      abstract protected function escapeUnicode(int $cp): string;
 58   
 59      /**
 60      * {@inheritdoc}
 61      */
 62      protected function outputValidValue(int $value): string
 63      {
 64          if ($value < 32)
 65          {
 66              return $this->escapeControlCode($value);
 67          }
 68   
 69          if ($value < 127)
 70          {
 71              return chr($value);
 72          }
 73   
 74          return ($value > 255) ? $this->escapeUnicode($value) : $this->escapeAscii($value);
 75      }
 76  }