0 follower

Class Yiisoft\YiiDevTool\Infrastructure\Composer\Config\Dependency\ComposerConfigDependency

InheritanceYiisoft\YiiDevTool\Infrastructure\Composer\Config\Dependency\ComposerConfigDependency

Constants

Hide inherited constants

Constant Value Description Defined By
PLATFORM_PACKAGE_REGEX '{^(?:php(?:-64bit|-ipv6|-zts|-debug)?|hhvm|(?:ext|lib)-[a-z0-9](?:[_.-]?[a-z0-9]+)*|composer-(?:plugin|runtime)-api)$}iD' Yiisoft\YiiDevTool\Infrastructure\Composer\Config\Dependency\ComposerConfigDependency

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( string $packageName, string $constraint )
$packageName string
$constraint string

                public function __construct(private string $packageName, private string $constraint)
{
}

            
constraintContainsAnyOfStabilityFlags() public method

public boolean constraintContainsAnyOfStabilityFlags ( string[] $flags )
$flags string[]

                public function constraintContainsAnyOfStabilityFlags(array $flags): bool
{
    foreach ($flags as $flag) {
        if (str_contains($this->constraint, $flag)) {
            return true;
        }
    }
    return false;
}

            
getConstraint() public method

public string getConstraint ( )

                public function getConstraint(): string
{
    return $this->constraint;
}

            
getPackageName() public method

public string getPackageName ( )

                public function getPackageName(): string
{
    return $this->packageName;
}

            
getPriority() public method

The real prioritization algorithm is more complicated: https://github.com/composer/composer/blob/ec9ca9e7398229d6162c0d5e8b64990175476335/src/Composer/Json/JsonManipulator.php#L110-L146

We use here a simplified version.

public integer getPriority ( )
return integer

Conditional dependency priority for sorting.

                public function getPriority(): int
{
    $name = $this->packageName;
    if ($name === 'php') {
        return 0;
    }
    if (str_starts_with($name, 'ext-')) {
        return 1;
    }
    return 2;
}

            
isPlatformRequirement() public method

public boolean isPlatformRequirement ( )

                public function isPlatformRequirement(): bool
{
    return (bool) preg_match(self::PLATFORM_PACKAGE_REGEX, $this->packageName);
}