Final Class Yiisoft\Config\FilesExtractor
| Inheritance | Yiisoft\ |
|---|
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\ |
|
| extract() | Extracts group configuration data from files. | Yiisoft\ |
| hasGroup() | Checks whether the group exists in the merge plan. | Yiisoft\ |
Method Details
| public mixed __construct ( Yiisoft\ | ||
| $paths | Yiisoft\ |
|
| $mergePlan | Yiisoft\ |
|
| $dataModifiers | Yiisoft\ |
|
| $environment | string | |
public function __construct(
private readonly ConfigPaths $paths,
private readonly MergePlan $mergePlan,
private readonly DataModifiers $dataModifiers,
private readonly string $environment,
) {}
Extracts group configuration data from files.
| public array extract ( string $group ) | ||
| $group | string |
The group name. |
| throws | ErrorException |
If an error occurred during the extract. |
|---|---|---|
public function extract(string $group): array
{
$environment = $this->prepareEnvironment($group);
$result = $this->process(Options::DEFAULT_ENVIRONMENT, $group, $this->mergePlan->getGroup($group));
if ($environment !== Options::DEFAULT_ENVIRONMENT) {
$result = array_merge(
$result,
$this->process(
$environment,
$group,
$this->mergePlan->getGroup($group, $environment),
),
);
}
return $result;
}
Checks whether the group exists in the merge plan.
| public boolean hasGroup ( string $group ) | ||
| $group | string |
The group name. |
| return | boolean |
Whether the group exists in the merge plan. |
|---|---|---|
public function hasGroup(string $group): bool
{
return $this->mergePlan->hasGroup($group, $this->environment) || (
$this->environment !== Options::DEFAULT_ENVIRONMENT
&& $this->mergePlan->hasGroup($group, Options::DEFAULT_ENVIRONMENT)
);
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.