NoticeChecks.php
1 KB
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
<?php
namespace AC\Service;
use AC\Asset\Location\Absolute;
use AC\Capabilities;
use AC\Check;
use AC\IntegrationRepository;
use AC\Registerable;
use AC\Services;
class NoticeChecks implements Registerable
{
private $location;
private $integration_repository;
public function __construct(Absolute $location, IntegrationRepository $integration_repository)
{
$this->location = $location;
$this->integration_repository = $integration_repository;
}
public function register(): void
{
$this->create_services()->register();
}
private function create_services(): Services
{
$services = new Services();
if (current_user_can(Capabilities::MANAGE)) {
$services->add(new Check\Review($this->location));
foreach ($this->integration_repository->find_all_by_active_plugins() as $integration) {
$services->add(new Check\AddonAvailable($integration));
}
}
return $services;
}
}