0 follower

Final Class Yiisoft\Config\Composer\ProcessHelper

InheritanceYiisoft\Config\Composer\ProcessHelper

Public Methods

Hide inherited methods

Method Description Defined By
__construct() Yiisoft\Config\Composer\ProcessHelper
getEnvironmentConfig() Returns the environment configuration. Yiisoft\Config\Composer\ProcessHelper
getMergePlanFile() Yiisoft\Config\Composer\ProcessHelper
getPackages() Returns all vendor packages. Yiisoft\Config\Composer\ProcessHelper
getPaths() Returns the config paths instance. Yiisoft\Config\Composer\ProcessHelper
getRelativePackageFilePath() Returns the relative path to the package file including the source directory {@see Options::sourceDirectory()}. Yiisoft\Config\Composer\ProcessHelper
getRelativePackageFilePathWithPackageName() Returns the relative path to the package file including the package name. Yiisoft\Config\Composer\ProcessHelper
getRootPackageConfig() Returns the root package configuration. Yiisoft\Config\Composer\ProcessHelper
getVendorOverridePackages() Returns vendor packages only from the vendor override sublayer. Yiisoft\Config\Composer\ProcessHelper
getVendorPackages() Returns vendor packages without packages from the vendor override sublayer. Yiisoft\Config\Composer\ProcessHelper
shouldBuildMergePlan() Checks whether to build a merge plan. Yiisoft\Config\Composer\ProcessHelper

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( \Composer\Composer $composer )
$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();
}

            
getEnvironmentConfig() public method

Returns the environment configuration.

public array getEnvironmentConfig ( )
return array

The environment configuration.

                public function getEnvironmentConfig(): array
{
    return $this->appConfigSettings->environmentsConfiguration();
}

            
getMergePlanFile() public method

public string getMergePlanFile ( )
return string

The merge plan filepath.

                public function getMergePlanFile(): string
{
    return $this->appConfigSettings->options()->mergePlanFile();
}

            
getPackages() public method

Returns all vendor packages.

public array getPackages ( )

                public function getPackages(): array
{
    return $this->packages;
}

            
getPaths() public method

Returns the config paths instance.

public Yiisoft\Config\ConfigPaths getPaths ( )
return Yiisoft\Config\ConfigPaths

The config paths instance.

                public function getPaths(): ConfigPaths
{
    return $this->paths;
}

            
getRelativePackageFilePath() public method

Returns the relative path to the package file including the source directory {@see Options::sourceDirectory()}.

public string getRelativePackageFilePath ( \Composer\Package\PackageInterface $package, string $filePath )
$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);
}

            
getRelativePackageFilePathWithPackageName() public method

Returns the relative path to the package file including the package name.

public string getRelativePackageFilePathWithPackageName ( \Composer\Package\PackageInterface $package, string $filePath )
$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)}";
}

            
getRootPackageConfig() public method

Returns the root package configuration.

public array getRootPackageConfig ( )
return array

The root package configuration.

                public function getRootPackageConfig(): array
{
    return $this->appConfigSettings->packageConfiguration();
}

            
getVendorOverridePackages() public method

Returns vendor packages only from the vendor override sublayer.

public array getVendorOverridePackages ( )

                public function getVendorOverridePackages(): array
{
    $vendorOverridePackages = [];
    foreach ($this->packages as $name => $package) {
        if ($this->isVendorOverridePackage($name)) {
            $vendorOverridePackages[$name] = $package;
        }
    }
    return $vendorOverridePackages;
}

            
getVendorPackages() public method

Returns vendor packages without packages from the vendor override sublayer.

public array getVendorPackages ( )

                public function getVendorPackages(): array
{
    $vendorPackages = [];
    foreach ($this->packages as $name => $package) {
        if (!$this->isVendorOverridePackage($name)) {
            $vendorPackages[$name] = $package;
        }
    }
    return $vendorPackages;
}

            
shouldBuildMergePlan() public method

Checks whether to build a merge plan.

public boolean shouldBuildMergePlan ( )
return boolean

Whether to build a merge plan.

                public function shouldBuildMergePlan(): bool
{
    return $this->appConfigSettings->options()->buildMergePlan();
}