Class Yiisoft\YiiDevTool\Infrastructure\Composer\ComposerPackage
| Inheritance | Yiisoft\YiiDevTool\Infrastructure\Composer\ComposerPackage |
|---|
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\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;
}
| 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();
}
Signup or Login in order to comment.