Final Class Yiisoft\Config\FilesExtractor
| Inheritance | Yiisoft\Config\FilesExtractor |
|---|
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\Config\FilesExtractor | |
| extract() | Extracts group configuration data from files. | Yiisoft\Config\FilesExtractor |
| hasGroup() | Checks whether the group exists in the merge plan. | Yiisoft\Config\FilesExtractor |
Method Details
| public mixed __construct ( Yiisoft\Config\ConfigPaths $paths, Yiisoft\Config\MergePlan $mergePlan, Yiisoft\Config\DataModifiers $dataModifiers, string $environment ) | ||
| $paths | Yiisoft\Config\ConfigPaths | |
| $mergePlan | Yiisoft\Config\MergePlan | |
| $dataModifiers | Yiisoft\Config\DataModifiers | |
| $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)
);
}
Signup or Login in order to comment.