Final Class Yiisoft\Config\Composer\ProcessHelper
| Inheritance | Yiisoft\Config\Composer\ProcessHelper |
|---|
Public Methods
Method Details
| public __construct( \Composer\Composer $composer ): mixed | ||
| $composer | \Composer\Composer |
The composer instance. |
public function __construct(
private readonly Composer $composer,
) {
/** @psalm-suppress UnresolvableInclude, MixedOperand */
require_once $composer->getConfig()->get('vendor-dir') . '/autoload.php';
$this->appConfigSettings = ConfigSettings::forRootPackage($composer);
$this->paths = new ConfigPaths(
$this->appConfigSettings->path(),
$this->appConfigSettings->options()->sourceDirectory(),
);
$this->packages = (new PackagesListBuilder(
$this->composer,
$this->appConfigSettings->options()->packageTypes(),
))->build();
}
Returns the environment configuration.
| public getEnvironmentConfig( ): array | ||
| return | array |
The environment configuration. |
|---|---|---|
public function getEnvironmentConfig(): array
{
return $this->appConfigSettings->environmentsConfiguration();
}
| public getMergePlanFile( ): string | ||
| return | string |
The merge plan filepath. |
|---|---|---|
public function getMergePlanFile(): string
{
return $this->appConfigSettings->options()->mergePlanFile();
}
Returns all vendor packages.
| public getPackages( ): array |
public function getPackages(): array
{
return $this->packages;
}
Returns the config paths instance.
| public getPaths( ): Yiisoft\Config\ConfigPaths | ||
| return | Yiisoft\Config\ConfigPaths |
The config paths instance. |
|---|---|---|
public function getPaths(): ConfigPaths
{
return $this->paths;
}
Returns the relative path to the package file including the source directory Yiisoft\Config\Composer\Options::sourceDirectory().
| public getRelativePackageFilePath( \Composer\Package\PackageInterface $package, string $filePath ): string | ||
| $package | \Composer\Package\PackageInterface |
The package instance. |
| $filePath | string |
The absolute path to the package file. |
| return | string |
The relative path to the package file including the source directory. |
|---|---|---|
public function getRelativePackageFilePath(PackageInterface $package, string $filePath): string
{
return str_replace("{$this->getPackageRootDirectoryPath($package)}/", '', $filePath);
}
Returns the relative path to the package file including the package name.
| public getRelativePackageFilePathWithPackageName( \Composer\Package\PackageInterface $package, string $filePath ): string | ||
| $package | \Composer\Package\PackageInterface |
The package instance. |
| $filePath | string |
The absolute path to the package file. |
| return | string |
The relative path to the package file including the package name. |
|---|---|---|
public function getRelativePackageFilePathWithPackageName(PackageInterface $package, string $filePath): string
{
return "{$package->getPrettyName()}/{$this->getRelativePackageFilePath($package, $filePath)}";
}
Returns the root package configuration.
| public getRootPackageConfig( ): array | ||
| return | array |
The root package configuration. |
|---|---|---|
public function getRootPackageConfig(): array
{
return $this->appConfigSettings->packageConfiguration();
}
Returns vendor packages only from the vendor override sublayer.
| public getVendorOverridePackages( ): array |
public function getVendorOverridePackages(): array
{
$vendorOverridePackages = [];
foreach ($this->packages as $name => $package) {
if ($this->isVendorOverridePackage($name)) {
$vendorOverridePackages[$name] = $package;
}
}
return $vendorOverridePackages;
}
Returns vendor packages without packages from the vendor override sublayer.
| public getVendorPackages( ): array |
public function getVendorPackages(): array
{
$vendorPackages = [];
foreach ($this->packages as $name => $package) {
if (!$this->isVendorOverridePackage($name)) {
$vendorPackages[$name] = $package;
}
}
return $vendorPackages;
}
Checks whether to build a merge plan.
| public shouldBuildMergePlan( ): boolean | ||
| return | boolean |
Whether to build a merge plan. |
|---|---|---|
public function shouldBuildMergePlan(): bool
{
return $this->appConfigSettings->options()->buildMergePlan();
}
Signup or Login in order to comment.