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

AttributeCollection.php

Zuletzt modifiziert: 02.04.2025, 15:04 - Dateigröße: 1.21 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\Attribute;
12  use s9e\TextFormatter\Configurator\Validators\AttributeName;
13   
14  class AttributeCollection 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("Attribute '" . $key . "' already exists");
27      }
28   
29      /**
30      * {@inheritdoc}
31      */
32      protected function getNotExistException($key)
33      {
34          return new RuntimeException("Attribute '" . $key . "' does not exist");
35      }
36   
37      /**
38      * Normalize a key as an attribute name
39      *
40      * @param  string $key
41      * @return string
42      */
43      public function normalizeKey($key)
44      {
45          return AttributeName::normalize($key);
46      }
47   
48      /**
49      * Normalize a value to an instance of Attribute
50      *
51      * @param  array|null|Attribute $value
52      * @return Attribute
53      */
54      public function normalizeValue($value)
55      {
56          return ($value instanceof Attribute)
57               ? $value
58               : new Attribute($value);
59      }
60  }