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

PromoteSingleStrings.php

Zuletzt modifiziert: 01.05.2026, 11:27 - Dateigröße: 1.05 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\Passes;
 09   
 10  use function array_map, array_merge, count, is_array;
 11   
 12  /**
 13  * Replaces alternations that only contain one string to allow other passes to replace
 14  * (?:a0?x|bx) with (?:a0?|b)x
 15  */
 16  class PromoteSingleStrings extends AbstractPass
 17  {
 18      /**
 19      * {@inheritdoc}
 20      */
 21      protected function runPass(array $strings): array
 22      {
 23          return array_map([$this, 'promoteSingleStrings'], $strings);
 24      }
 25   
 26      /**
 27      * Promote single strings found inside given string
 28      *
 29      * @param  array $string Original string
 30      * @return array         Modified string
 31      */
 32      protected function promoteSingleStrings(array $string): array
 33      {
 34          $newString = [];
 35          foreach ($string as $element)
 36          {
 37              if (is_array($element) && count($element) === 1)
 38              {
 39                  $newString = array_merge($newString, $element[0]);
 40              }
 41              else
 42              {
 43                  $newString[] = $element;
 44              }
 45          }
 46   
 47          return $newString;
 48      }
 49  }