forked from magento/magento2
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFullModuleList.php
78 lines (71 loc) · 1.42 KB
/
FullModuleList.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Framework\Module;
/**
* A list of modules in the Magento application
*
* Represents all modules, regardless of enabled or not
*/
class FullModuleList implements ModuleListInterface
{
/**
* Loader of module information from source code
*
* @var ModuleList\Loader
*/
private $loader;
/**
* Enumeration of the module names
*
* @var string[]
*/
private $data;
/**
* Constructor
*
* @param ModuleList\Loader $loader
*/
public function __construct(ModuleList\Loader $loader)
{
$this->loader = $loader;
}
/**
* {@inheritdoc}
* @see getNames()
*/
public function getAll()
{
if (null === $this->data) {
$this->data = $this->loader->load();
}
return $this->data;
}
/**
* {@inheritdoc}
* @see has()
*/
public function getOne($name)
{
$data = $this->getAll();
return isset($data[$name]) ? $data[$name] : null;
}
/**
* {@inheritdoc}
*/
public function getNames()
{
$data = $this->getAll();
return array_keys($data);
}
/**
* {@inheritdoc}
*/
public function has($name)
{
$this->getAll();
return isset($this->data[$name]);
}
}