Aggregate.php
33 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AC\DefaultColumnHandler; |
| 6 | |
| 7 | use AC\ColumnCollection; |
| 8 | use AC\DefaultColumnHandler; |
| 9 | use AC\TableScreen; |
| 10 | |
| 11 | final class Aggregate implements DefaultColumnHandler |
| 12 | { |
| 13 | /** |
| 14 | * @var DefaultColumnHandler[] |
| 15 | */ |
| 16 | private array $handlers = []; |
| 17 | |
| 18 | public function add(DefaultColumnHandler $handler): void |
| 19 | { |
| 20 | $this->handlers[] = $handler; |
| 21 | } |
| 22 | |
| 23 | public function handle(TableScreen $table_screen, ColumnCollection $default_columns): ColumnCollection |
| 24 | { |
| 25 | foreach ($this->handlers as $handler) { |
| 26 | $default_columns = $handler->handle($table_screen, $default_columns); |
| 27 | } |
| 28 | |
| 29 | return $default_columns; |
| 30 | } |
| 31 | |
| 32 | } |
| 33 |