Final Class Yiisoft\Config\MergePlan
| Inheritance | Yiisoft\Config\MergePlan |
|---|
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\Config\MergePlan | |
| add() | Adds an item to the merge plan. | Yiisoft\Config\MergePlan |
| addEnvironmentWithoutConfigs() | Adds an empty environment item to the merge plan. | Yiisoft\Config\MergePlan |
| addGroup() | Add empty group if it not exists. | Yiisoft\Config\MergePlan |
| addMultiple() | Adds a multiple items to the merge plan. | Yiisoft\Config\MergePlan |
| getGroup() | Returns the merge plan group. | Yiisoft\Config\MergePlan |
| hasEnvironment() | Checks whether the environment exists in the merge plan. | Yiisoft\Config\MergePlan |
| hasGroup() | Checks whether the group exists in the merge plan. | Yiisoft\Config\MergePlan |
| toArray() | Returns the merge plan as an array. | Yiisoft\Config\MergePlan |
Method Details
| public mixed __construct ( array $mergePlan = [] ) | ||
| $mergePlan | array | |
public function __construct(
private array $mergePlan = [],
) {
}
Adds an item to the merge plan.
| public void add ( string $file, string $package, string $group, string $environment = Options::DEFAULT_ENVIRONMENT ) | ||
| $file | string |
The config file. |
| $package | string |
The package name. |
| $group | string |
The group name. |
| $environment | string |
The environment name. |
public function add(
string $file,
string $package,
string $group,
string $environment = Options::DEFAULT_ENVIRONMENT
): void {
$this->mergePlan[$environment][$group][$package][] = $file;
}
Adds an empty environment item to the merge plan.
| public void addEnvironmentWithoutConfigs ( string $environment ) | ||
| $environment | string |
The environment name. |
public function addEnvironmentWithoutConfigs(string $environment): void
{
$this->mergePlan[$environment] = [];
}
Add empty group if it not exists.
| public void addGroup ( string $group, string $environment = Options::DEFAULT_ENVIRONMENT ) | ||
| $group | string |
The group name. |
| $environment | string |
The environment name. |
public function addGroup(string $group, string $environment = Options::DEFAULT_ENVIRONMENT): void
{
if (!isset($this->mergePlan[$environment][$group])) {
$this->mergePlan[$environment][$group] = [];
}
}
Adds a multiple items to the merge plan.
| public void addMultiple ( string[] $files, string $package, string $group, string $environment = Options::DEFAULT_ENVIRONMENT ) | ||
| $files | string[] |
The config files. |
| $package | string |
The package name. |
| $group | string |
The group name. |
| $environment | string |
The environment name. |
public function addMultiple(
array $files,
string $package,
string $group,
string $environment = Options::DEFAULT_ENVIRONMENT
): void {
$this->mergePlan[$environment][$group][$package] = $files;
}
Returns the merge plan group.
| public array<string, string[]> getGroup ( string $group, string $environment = Options::DEFAULT_ENVIRONMENT ) | ||
| $group | string |
The group name. |
| $environment | string |
The environment name. |
public function getGroup(string $group, string $environment = Options::DEFAULT_ENVIRONMENT): array
{
return $this->mergePlan[$environment][$group] ?? [];
}
Checks whether the environment exists in the merge plan.
| public boolean hasEnvironment ( string $environment ) | ||
| $environment | string |
The environment name. |
| return | boolean |
Whether the environment exists in the merge plan. |
|---|---|---|
public function hasEnvironment(string $environment): bool
{
return isset($this->mergePlan[$environment]);
}
Checks whether the group exists in the merge plan.
| public boolean hasGroup ( string $group, string $environment ) | ||
| $group | string |
The group name. |
| $environment | string |
The environment name. |
| return | boolean |
Whether the group exists in the merge plan. |
|---|---|---|
public function hasGroup(string $group, string $environment): bool
{
return isset($this->mergePlan[$environment][$group]);
}
Signup or Login in order to comment.