PluginRepository.php
852 Bytes
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 ACP;
use AC\IntegrationRepository;
use AC\PluginInformation;
use ACP\Integration\Filter\IsActive;
class PluginRepository {
/**
* @var string
*/
private $basename;
/**
* @var IntegrationRepository
*/
private $integration_repository;
public function __construct( $basename, IntegrationRepository $integration_repository ) {
$this->basename = (string) $basename;
$this->integration_repository = $integration_repository;
}
/**
* @return Plugins
*/
public function find_all() {
$plugins = [
new PluginInformation( $this->basename ),
];
$addons = $this->integration_repository->find_all( [
IntegrationRepository::ARG_FILTER => [ new IsActive() ],
] );
foreach ( $addons as $addon ) {
$plugins[] = new PluginInformation( $addon->get_basename() );
}
return new Plugins( $plugins );
}
}