Class Yiisoft\YiiDevTool\Infrastructure\Composer\ComposerPackage
| Inheritance | Yiisoft\YiiDevTool\Infrastructure\Composer\ComposerPackage |
|---|
Public Methods
Method Details
| public __construct( string $name, string $path ): mixed | ||
| $name | string | |
| $path | string | |
public function __construct(private string $name, private string $path)
{
}
| public composerConfigFileExists( ): boolean |
public function composerConfigFileExists(): bool
{
return file_exists($this->getComposerConfigPath());
}
| public doesProvidePackage( string $packageName ): boolean | ||
| $packageName | string | |
public function doesProvidePackage(string $packageName): bool
{
return array_key_exists($packageName, $this->getProvidedPackagesAsArray());
}
| 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;
}
| public getComposerConfigPath( ): string |
public function getComposerConfigPath(): string
{
return "{$this->path}/composer.json";
}
| public getPSRNamespaces( ): array |
public function getPSRNamespaces(): array
{
return $this
->getComposerConfig()
->getPSRNamespaces();
}
| public getProvidedPackagesAsArray( ): array |
public function getProvidedPackagesAsArray(): array
{
$provideSectionData = $this
->getComposerConfig()
->getSection(ComposerConfig::SECTION_PROVIDE);
return $provideSectionData ?? [];
}
| public isComposerPlugin( ): boolean |
public function isComposerPlugin(): bool
{
return $this
->getComposerConfig()
->getSection('type') === 'composer-plugin';
}
| public providesBinaries( ): boolean |
public function providesBinaries(): bool
{
return $this
->getComposerConfig()
->hasSection('bin');
}
| public usesNonPSRAutoload( ): boolean |
public function usesNonPSRAutoload(): bool
{
return $this
->getComposerConfig()
->usesNonPSRAutoload();
}
Signup or Login in order to comment.