0 follower

Class Yiisoft\YiiDevTool\Infrastructure\Composer\ComposerPackage

InheritanceYiisoft\YiiDevTool\Infrastructure\Composer\ComposerPackage

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( string $name, string $path )
$name string
$path string

                public function __construct(private string $name, private string $path)
{
}

            
composerConfigFileExists() public method

public boolean composerConfigFileExists ( )

                public function composerConfigFileExists(): bool
{
    return file_exists($this->getComposerConfigPath());
}

            
doesProvidePackage() public method

public boolean doesProvidePackage ( string $packageName )
$packageName string

                public function doesProvidePackage(string $packageName): bool
{
    return array_key_exists($packageName, $this->getProvidedPackagesAsArray());
}

            
getComposerConfig() public method

public Yiisoft\YiiDevTool\Infrastructure\Composer\Config\ComposerConfig getComposerConfig ( )

                public function getComposerConfig(): ComposerConfig
{
    if (!$this->composerConfigFileExists()) {
        throw new RuntimeException('Failed to get ComposerConfig because composer.json does not exist.');
    }
    if ($this->config === null) {
        $this->config = ComposerConfig::createByFilePath($this->getComposerConfigPath());
    }
    return $this->config;
}

            
getComposerConfigPath() public method

public string getComposerConfigPath ( )

                public function getComposerConfigPath(): string
{
    return "{$this->path}/composer.json";
}

            
getName() public method

public string getName ( )

                public function getName(): string
{
    return $this->name;
}

            
getPSRNamespaces() public method

public array getPSRNamespaces ( )

                public function getPSRNamespaces(): array
{
    return $this
        ->getComposerConfig()
        ->getPSRNamespaces();
}

            
getPath() public method

public string getPath ( )

                public function getPath(): string
{
    return $this->path;
}

            
getProvidedPackagesAsArray() public method

public array getProvidedPackagesAsArray ( )

                public function getProvidedPackagesAsArray(): array
{
    $provideSectionData = $this
        ->getComposerConfig()
        ->getSection(ComposerConfig::SECTION_PROVIDE);
    return $provideSectionData ?? [];
}

            
isComposerPlugin() public method

public boolean isComposerPlugin ( )

                public function isComposerPlugin(): bool
{
    return $this
            ->getComposerConfig()
            ->getSection('type') === 'composer-plugin';
}

            
providesBinaries() public method

public boolean providesBinaries ( )

                public function providesBinaries(): bool
{
    return $this
        ->getComposerConfig()
        ->hasSection('bin');
}

            
usesNonPSRAutoload() public method

public boolean usesNonPSRAutoload ( )

                public function usesNonPSRAutoload(): bool
{
    return $this
        ->getComposerConfig()
        ->usesNonPSRAutoload();
}