0 follower

Class Yiisoft\YiiDevTool\Infrastructure\Composer\ComposerPackage

InheritanceYiisoft\YiiDevTool\Infrastructure\Composer\ComposerPackage

Method Details

Hide inherited methods

__construct() public method

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

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

            
composerConfigFileExists() public method

public composerConfigFileExists( ): boolean

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

            
doesProvidePackage() public method

public doesProvidePackage( string $packageName ): boolean
$packageName string

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

            
getComposerConfig() public method

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

                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 getComposerConfigPath( ): string

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

            
getName() public method

public getName( ): string

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

            
getPSRNamespaces() public method

public getPSRNamespaces( ): array

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

            
getPath() public method

public getPath( ): string

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

            
getProvidedPackagesAsArray() public method

public getProvidedPackagesAsArray( ): array

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

            
isComposerPlugin() public method

public isComposerPlugin( ): boolean

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

            
providesBinaries() public method

public providesBinaries( ): boolean

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

            
usesNonPSRAutoload() public method

public usesNonPSRAutoload( ): boolean

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