-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathIntegrationRepository.php
59 lines (47 loc) · 1.48 KB
/
IntegrationRepository.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
namespace AC;
use AC\Integration\Filter;
class IntegrationRepository
{
public function find_all(): Integrations
{
static $integrations = null;
if (null === $integrations) {
$integrations = new Integrations([
new Integration\ACF(),
new Integration\BuddyPress(),
new Integration\EventsCalendar(),
new Integration\GravityForms(),
new Integration\JetEngine(),
new Integration\Pods(),
new Integration\Types(),
new Integration\MetaBox(),
new Integration\MediaLibraryAssistant(),
new Integration\WooCommerce(),
new Integration\YoastSeo(),
]);
}
return $integrations;
}
public function find_by_slug(string $slug): ?Integration
{
foreach ($this->find_all() as $integration) {
if ($integration->get_slug() === $slug) {
return $integration;
}
}
return null;
}
public function find_all_active(): Integrations
{
return (new Filter\IsActive())->filter($this->find_all());
}
public function find_all_by_active_plugins(): Integrations
{
return (new Filter\IsPluginActive())->filter($this->find_all());
}
public function find_all_by_inactive_plugins(): Integrations
{
return (new Filter\IsPluginNotActive())->filter($this->find_all());
}
}