forked from magento/magento2
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathManager.php
99 lines (92 loc) · 2.84 KB
/
Manager.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?php
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Framework\Module;
/**
* Module status manager.
*
* Usage:
* ```php
* $manager->isEnabled('Vendor_Module');
* ```
*/
class Manager
{
/**
* The checker of output modules.
*
* @var Output\ConfigInterface the config checker of output modules.
* @deprecated Magento does not support custom disabling/enabling module output since 2.2.0 version.
* The property can be removed in a future major release
*/
private $outputConfig;
/**
* The list of all modules.
*
* @var ModuleListInterface the list of all modules.
*/
private $moduleList;
/**
* The list of config paths to ignore.
*
* @var array the list of config paths to ignore.
* @deprecated Magento does not support custom disabling/enabling module output since 2.2.0 version.
* The property can be removed in a future major release
*/
private $outputConfigPaths;
/**
* Constructor.
*
* @param Output\ConfigInterface $outputConfig the checker of output modules
* @param ModuleListInterface $moduleList the list of all modules
* @param array $outputConfigPaths the list of config paths to ignore
*/
public function __construct(
Output\ConfigInterface $outputConfig,
ModuleListInterface $moduleList,
array $outputConfigPaths = []
) {
$this->outputConfig = $outputConfig;
$this->moduleList = $moduleList;
$this->outputConfigPaths = $outputConfigPaths;
}
/**
* Checks whether a module is enabled in the configuration or not.
*
* @param string $moduleName the fully-qualified module name
*
* @return boolean true if module is enabled, false otherwise
*/
public function isEnabled($moduleName)
{
return $this->moduleList->has($moduleName);
}
/**
* Checks whether a module output is permitted by the configuration or not.
*
* @param string $moduleName the fully-qualified module name.
*
* @return boolean
* @deprecated Magento does not support custom disabling/enabling module output since 2.2.0 version
*/
public function isOutputEnabled($moduleName)
{
return $this->isEnabled($moduleName);
}
/**
* Checks whether a configuration switch for a module output permits output.
*
* @param string $moduleName Fully-qualified module name
*
* @return boolean
* @deprecated Magento does not support custom disabling/enabling module output since 2.2.0 version.
* The method can be removed in a future major release
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
protected function _isCustomOutputConfigEnabled($moduleName)
{
return true;
}
}