1 | <?php |
||
26 | class InstallInfo |
||
27 | { |
||
28 | /** |
||
29 | * The default installer of modules. |
||
30 | */ |
||
31 | const DEFAULT_INSTALLER_NAME = 'user'; |
||
32 | |||
33 | /** |
||
34 | * @var string |
||
35 | */ |
||
36 | private $installPath; |
||
37 | |||
38 | /** |
||
39 | * @var string|null |
||
40 | */ |
||
41 | private $moduleName; |
||
42 | |||
43 | /** |
||
44 | * @var string |
||
45 | */ |
||
46 | private $env = Environment::PROD; |
||
47 | |||
48 | /** |
||
49 | * @var string |
||
50 | */ |
||
51 | private $installerName = self::DEFAULT_INSTALLER_NAME; |
||
52 | |||
53 | /** |
||
54 | * @var Uuid[] |
||
55 | */ |
||
56 | private $disabledBindingUuids = array(); |
||
57 | |||
58 | /** |
||
59 | * Creates a new install info. |
||
60 | * |
||
61 | * @param string $moduleName The module name. Must be a non-empty string. |
||
62 | * @param string $installPath The path where the module is installed. |
||
63 | * If a relative path is given, the path is |
||
64 | * assumed to be relative to the install path |
||
65 | * of the root module. |
||
66 | * |
||
67 | * @throws InvalidArgumentException If any of the arguments is invalid. |
||
68 | */ |
||
69 | 208 | public function __construct($moduleName, $installPath) |
|
77 | |||
78 | /** |
||
79 | * Returns the path where the module is installed. |
||
80 | * |
||
81 | * @return string The path where the module is installed. The path is |
||
82 | * either absolute or relative to the install path of the |
||
83 | * root module. |
||
84 | */ |
||
85 | 56 | public function getInstallPath() |
|
89 | |||
90 | /** |
||
91 | * Returns the module name. |
||
92 | * |
||
93 | * @return null|string Returns the module name or `null` if the name is |
||
94 | * read from the module's puli.json file. |
||
95 | */ |
||
96 | 198 | public function getModuleName() |
|
100 | |||
101 | /** |
||
102 | * Returns the name of the installer of the module. |
||
103 | * |
||
104 | * @return string The module's installer name. |
||
105 | */ |
||
106 | 8 | public function getInstallerName() |
|
110 | |||
111 | /** |
||
112 | * Sets the name of the installer of the module. |
||
113 | * |
||
114 | * @param string $installerName The module's installer name. |
||
115 | */ |
||
116 | 12 | public function setInstallerName($installerName) |
|
120 | |||
121 | /** |
||
122 | * Returns the disabled resource bindings of the module. |
||
123 | * |
||
124 | * @return Uuid[] The UUIDs of the disabled resource bindings. |
||
125 | */ |
||
126 | 16 | public function getDisabledBindingUuids() |
|
130 | |||
131 | /** |
||
132 | * Adds a disabled resource binding for the module. |
||
133 | * |
||
134 | * @param Uuid $uuid The UUID of the disabled resource binding. |
||
135 | */ |
||
136 | 19 | public function addDisabledBindingUuid(Uuid $uuid) |
|
140 | |||
141 | /** |
||
142 | * Removes a disabled resource binding. |
||
143 | * |
||
144 | * If the resource binding is not disabled, this method does nothing. |
||
145 | * |
||
146 | * @param Uuid $uuid The UUID of the resource binding to remove. |
||
147 | */ |
||
148 | 9 | public function removeDisabledBindingUuid(Uuid $uuid) |
|
152 | |||
153 | /** |
||
154 | * Returns whether the resource binding is disabled. |
||
155 | * |
||
156 | * @param Uuid $uuid The UUID of the resource binding. |
||
157 | * |
||
158 | * @return bool Whether the resource binding is disabled. |
||
159 | */ |
||
160 | 24 | public function hasDisabledBindingUuid(Uuid $uuid) |
|
164 | |||
165 | /** |
||
166 | * Returns whether the install info contains disabled bindings. |
||
167 | * |
||
168 | * @return bool Whether any bindings are disabled. |
||
169 | */ |
||
170 | 3 | public function hasDisabledBindingUuids() |
|
174 | |||
175 | /** |
||
176 | * Sets the environment that the module is installed in. |
||
177 | * |
||
178 | * @param string $env One of the {@link Environment} constants. |
||
179 | */ |
||
180 | 10 | public function setEnvironment($env) |
|
186 | |||
187 | /** |
||
188 | * Returns the environment that the module is installed in. |
||
189 | * |
||
190 | * @return string Returns one of the {@link Environment} constants. |
||
191 | */ |
||
192 | 6 | public function getEnvironment() |
|
196 | } |
||
197 |