Final Class Yiisoft\Config\Composer\ProcessHelper
| Inheritance | Yiisoft\Config\Composer\ProcessHelper |
|---|
Public Methods
Method Details
| 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();
}
Returns the environment configuration.
| public array getEnvironmentConfig ( ) | ||
| return | array |
The environment configuration. |
|---|---|---|
public function getEnvironmentConfig(): array
{
return $this->appConfigSettings->environmentsConfiguration();
}
| public string getMergePlanFile ( ) | ||
| return | string |
The merge plan filepath. |
|---|---|---|
public function getMergePlanFile(): string
{
return $this->appConfigSettings->options()->mergePlanFile();
}
Returns all vendor packages.
| public array getPackages ( ) |
public function getPackages(): array
{
return $this->packages;
}
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;
}
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);
}
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)}";
}
Returns the root package configuration.
| public array getRootPackageConfig ( ) | ||
| return | array |
The root package configuration. |
|---|---|---|
public function getRootPackageConfig(): array
{
return $this->appConfigSettings->packageConfiguration();
}
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;
}
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;
}
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();
}
Signup or Login in order to comment.