Verzeichnisstruktur phpBB-3.3.15


Veröffentlicht
28.08.2024

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

TagCollection.php

Zuletzt modifiziert: 02.04.2025, 15:04 - Dateigröße: 1.20 KiB


01  <?php
02   
03  /**
04  * @package   s9e\TextFormatter
05  * @copyright Copyright (c) 2010-2022 The s9e authors
06  * @license   http://www.opensource.org/licenses/mit-license.php The MIT License
07  */
08  namespace s9e\TextFormatter\Configurator\Collections;
09   
10  use RuntimeException;
11  use s9e\TextFormatter\Configurator\Items\Tag;
12  use s9e\TextFormatter\Configurator\Validators\TagName;
13   
14  class TagCollection extends NormalizedCollection
15  {
16      /**
17      * {@inheritdoc}
18      */
19      protected $onDuplicateAction = 'replace';
20   
21      /**
22      * {@inheritdoc}
23      */
24      protected function getAlreadyExistsException($key)
25      {
26          return new RuntimeException("Tag '" . $key . "' already exists");
27      }
28   
29      /**
30      * {@inheritdoc}
31      */
32      protected function getNotExistException($key)
33      {
34          return new RuntimeException("Tag '" . $key . "' does not exist");
35      }
36   
37      /**
38      * Normalize a tag name used as a key in this colelction
39      *
40      * @param  string $key Original name
41      * @return string      Normalized name
42      */
43      public function normalizeKey($key)
44      {
45          return TagName::normalize($key);
46      }
47   
48      /**
49      * Normalize a value to an instance of Tag
50      *
51      * @param  array|null|Tag $value
52      * @return Tag
53      */
54      public function normalizeValue($value)
55      {
56          return ($value instanceof Tag)
57               ? $value
58               : new Tag($value);
59      }
60  }