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. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
Collection.php
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 Countable;
11 use Iterator;
12 use s9e\TextFormatter\Configurator\ConfigProvider;
13 use s9e\TextFormatter\Configurator\Helpers\ConfigHelper;
14
15 class Collection implements ConfigProvider, Countable, Iterator
16 {
17 /**
18 * @var array Items that this collection holds
19 */
20 protected $items = [];
21
22 /**
23 * Empty this collection
24 */
25 public function clear()
26 {
27 $this->items = [];
28 }
29
30 /**
31 * @return mixed
32 */
33 public function asConfig()
34 {
35 return ConfigHelper::toArray($this->items, true);
36 }
37
38 //==========================================================================
39 // Countable stuff
40 //==========================================================================
41
42 /**
43 * @return integer
44 */
45 public function count(): int
46 {
47 return count($this->items);
48 }
49
50 //==========================================================================
51 // Iterator stuff
52 //==========================================================================
53
54 /**
55 * @return mixed
56 */
57 #[\ReturnTypeWillChange]
58 public function current()
59 {
60 return current($this->items);
61 }
62
63 /**
64 * @return integer|string
65 */
66 #[\ReturnTypeWillChange]
67 public function key()
68 {
69 return key($this->items);
70 }
71
72 /**
73 * @return mixed
74 */
75 #[\ReturnTypeWillChange]
76 public function next()
77 {
78 return next($this->items);
79 }
80
81 /**
82 * @return void
83 */
84 public function rewind(): void
85 {
86 reset($this->items);
87 }
88
89 /**
90 * @return bool
91 */
92 public function valid(): bool
93 {
94 return (key($this->items) !== null);
95 }
96 }