Class Yiisoft\YiiDevTool\Infrastructure\Composer\ComposerPackage
| Inheritance | Yiisoft\ |
|---|
Public Methods
Method Details
| public mixed __construct ( string $name, string $path ) | ||
| $name | string | |
| $path | string | |
public function __construct(private string $name, private string $path) {}
| public boolean composerConfigFileExists ( ) |
public function composerConfigFileExists(): bool
{
return file_exists($this->getComposerConfigPath());
}
| public boolean doesProvidePackage ( string $packageName ) | ||
| $packageName | string | |
public function doesProvidePackage(string $packageName): bool
{
return array_key_exists($packageName, $this->getProvidedPackagesAsArray());
}
| public Yiisoft\ |
public function getComposerConfig(): ComposerConfig
{
if (!$this->composerConfigFileExists()) {
throw new RuntimeException('Failed to get ComposerConfig because composer.json does not exist.');
}
$this->config ??= ComposerConfig::createByFilePath($this->getComposerConfigPath());
return $this->config;
}
| public string getComposerConfigPath ( ) |
public function getComposerConfigPath(): string
{
return "{$this->path}/composer.json";
}
| public array getPSRNamespaces ( ) |
public function getPSRNamespaces(): array
{
return $this
->getComposerConfig()
->getPSRNamespaces();
}
| public array getProvidedPackagesAsArray ( ) |
public function getProvidedPackagesAsArray(): array
{
$provideSectionData = $this
->getComposerConfig()
->getSection(ComposerConfig::SECTION_PROVIDE);
return $provideSectionData ?? [];
}
| public boolean isComposerPlugin ( ) |
public function isComposerPlugin(): bool
{
return $this
->getComposerConfig()
->getSection('type') === 'composer-plugin';
}
| public boolean providesBinaries ( ) |
public function providesBinaries(): bool
{
return $this
->getComposerConfig()
->hasSection('bin');
}
| public boolean usesNonPSRAutoload ( ) |
public function usesNonPSRAutoload(): bool
{
return $this
->getComposerConfig()
->usesNonPSRAutoload();
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.