PluginProbe ʕ •ᴥ•ʔ
Admin Columns / 7.1.4
Admin Columns v7.1.4
7.1.4 7.0.19 2.3.5 2.4 2.4.1 2.4.10 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.6.1 2.5.6.2 2.5.6.3 2.5.6.4 3.0 3.0.1 3.0.2 3.0.3 3.0.5 3.0.7 3.1 3.1.1 3.1.10 3.1.2 3.1.3 3.1.5 3.2.3 3.2.7 3.3.1 3.4.1 3.4.6 3.4.8 4.0.1 4.0.3 4.1.6 4.2.2 4.2.5 4.3 4.3.2 4.4.1 4.4.4 4.4.5 4.5.5 4.6.1 4.7.18 4.7.19 4.7.20 4.7.7 7.0.13 7.0.14 7.0.16 trunk 1.0 1.1 1.1.3 1.2 1.2.1 1.3 1.3.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.5.1 1.4.6 1.4.6.1 1.4.6.2 1.4.6.3 1.4.6.4 1.4.7 1.4.8 1.4.9 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.2 2.2.1 2.2.1.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.5.1 2.2.6 2.2.6.1 2.2.6.2 2.2.6.3 2.2.6.4 2.2.7 2.2.8 2.2.8.1 2.2.9 2.3.1 2.3.2 2.3.3
codepress-admin-columns / classes / Table / TableScreenRepository.php
codepress-admin-columns / classes / Table Last commit date
InlineStyle 2 days ago ManageHeading 2 days ago ManageValue 2 days ago SaveHeading 2 days ago Service 2 days ago TableScreenRepository 2 days ago AdminHeadStyle.php 2 days ago ManageValueServiceFactory.php 2 days ago PrimaryColumn.php 2 days ago PrimaryColumnFactory.php 2 days ago SaveHeadingFactory.php 2 days ago Screen.php 2 days ago ScreenTools.php 2 days ago TableFormView.php 2 days ago TablePreference.php 2 days ago TableScreenCollection.php 2 days ago TableScreenRepository.php 2 days ago
TableScreenRepository.php
92 lines
1 <?php
2
3 declare(strict_types=1);
4
5 namespace AC\Table;
6
7 use AC\Table\TableScreenRepository\Sort;
8 use AC\TableIdsFactory;
9 use AC\TableScreen;
10 use AC\TableScreenFactory;
11 use AC\Type\TableId;
12 use AC\Type\TableIdCollection;
13
14 class TableScreenRepository
15 {
16 protected TableIdsFactory $table_ids_factory;
17
18 protected TableScreenFactory $table_screen_factory;
19
20 public function __construct(TableIdsFactory $table_ids_factory, TableScreenFactory $table_screen_factory)
21 {
22 $this->table_ids_factory = $table_ids_factory;
23 $this->table_screen_factory = $table_screen_factory;
24 }
25
26 public function find(TableId $table_id): ?TableScreen
27 {
28 return $this->table_screen_factory->can_create($table_id)
29 ? $this->table_screen_factory->create($table_id)
30 : null;
31 }
32
33 public function find_all_by_ids(TableIdCollection $ids, ?Sort $sort = null): TableScreenCollection
34 {
35 $table_screens = new TableScreenCollection();
36
37 foreach ($ids as $key) {
38 if ($this->table_screen_factory->can_create($key)) {
39 $table_screens->add(
40 $this->table_screen_factory->create($key)
41 );
42 }
43 }
44
45 if ($sort) {
46 $table_screens = $sort->sort($table_screens);
47 }
48
49 return $table_screens;
50 }
51
52 public function find_all(?Sort $sort = null): TableScreenCollection
53 {
54 $table_screens = new TableScreenCollection();
55
56 foreach ($this->table_ids_factory->create() as $id) {
57 if (! $this->table_screen_factory->can_create($id)) {
58 continue;
59 }
60
61 $table_screens->add(
62 $this->table_screen_factory->create($id)
63 );
64 }
65
66 if ($sort) {
67 $table_screens = $sort->sort($table_screens);
68 }
69
70 return $table_screens;
71 }
72
73 public function find_all_site(): TableScreenCollection
74 {
75 return new TableScreenCollection(
76 array_filter(iterator_to_array($this->find_all()), static function (TableScreen $screen): bool {
77 return ! $screen->is_network();
78 })
79 );
80 }
81
82 public function find_all_network(): TableScreenCollection
83 {
84 return new TableScreenCollection(
85 array_filter(iterator_to_array($this->find_all()), static function (TableScreen $screen): bool {
86 return $screen->is_network();
87 })
88 );
89 }
90
91 }
92