Hook.php
3 months ago
HookCollection.php
3 months ago
HookCollectionFactory.php
3 months ago
Hooks.php
3 months ago
HookCollection.php
27 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AC\Deprecated; |
| 6 | |
| 7 | use AC\Collection; |
| 8 | |
| 9 | class HookCollection extends Collection |
| 10 | { |
| 11 | |
| 12 | public function __construct(array $hooks) |
| 13 | { |
| 14 | array_map([$this, 'add'], $hooks); |
| 15 | } |
| 16 | |
| 17 | public function add(Hook $hook): void |
| 18 | { |
| 19 | $this->data[] = $hook; |
| 20 | } |
| 21 | |
| 22 | public function current(): Hook |
| 23 | { |
| 24 | return current($this->data); |
| 25 | } |
| 26 | |
| 27 | } |