Filter
1 month ago
Rule
1 month ago
Sort
1 month ago
Storage
1 month ago
Base.php
1 month ago
Database.php
1 month ago
Filter.php
1 month ago
Rule.php
1 month ago
Rules.php
1 month ago
Sort.php
1 month ago
Storage.php
1 month ago
Types.php
1 month ago
Base.php
40 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AC\ListScreenRepository; |
| 6 | |
| 7 | use AC\ListScreenCollection; |
| 8 | use AC\ListScreenRepository; |
| 9 | use AC\Type\ListScreenId; |
| 10 | use AC\Type\ListScreenStatus; |
| 11 | use AC\Type\TableId; |
| 12 | use WP_User; |
| 13 | |
| 14 | abstract class Base implements ListScreenRepository |
| 15 | { |
| 16 | |
| 17 | public function exists(ListScreenId $id): bool |
| 18 | { |
| 19 | return null !== $this->find($id); |
| 20 | } |
| 21 | |
| 22 | protected function sort(ListScreenCollection $collection, ?Sort $sort = null): ListScreenCollection |
| 23 | { |
| 24 | return $sort |
| 25 | ? $sort->sort($collection) |
| 26 | : $collection; |
| 27 | } |
| 28 | |
| 29 | public function find_all_by_assigned_user( |
| 30 | TableId $table_id, |
| 31 | WP_User $user, |
| 32 | ?Sort $sort = null, |
| 33 | ?ListScreenStatus $status = null |
| 34 | ): ListScreenCollection { |
| 35 | return (new Filter\UserAssigned($user))->filter( |
| 36 | $this->find_all_by_table_id($table_id, $sort, $status) |
| 37 | ); |
| 38 | } |
| 39 | |
| 40 | } |