Class Yiisoft\YiiDevTool\Infrastructure\CodeUsage\NamespaceUsageFinder
| Inheritance | Yiisoft\YiiDevTool\Infrastructure\CodeUsage\NamespaceUsageFinder |
|---|
Public Methods
Method Details
| public self addTargetPaths ( string $environment, array $paths, string|null $basePath = null ) | ||
| $environment | string | |
| $paths | array | |
| $basePath | string|null | |
public function addTargetPaths(string $environment, array $paths, ?string $basePath = null): self
{
foreach ($paths as $path) {
if (!is_string($path)) {
throw new InvalidArgumentException('$paths must be an array of strings.');
}
}
if ($basePath !== null) {
foreach ($paths as &$path) {
$path = rtrim($basePath, '/') . '/' . ltrim($path, '/');
}
}
if (!array_key_exists($environment, $this->target)) {
$this->target[$environment] = [];
}
$this->target[$environment] = array_merge($this->target[$environment], $paths);
return $this;
}
| public Yiisoft\YiiDevTool\Infrastructure\CodeUsage\CodeUsage[] getUsages ( ) |
public function getUsages(): array
{
if ($this->usages === null) {
$this->find();
}
return $this->usages;
}
| public void registerNamespaceUsage ( string $namespace, string $environment ) | ||
| $namespace | string | |
| $environment | string | |
public function registerNamespaceUsage(string $namespace, string $environment): void
{
if (!array_key_exists($namespace, $this->usages)) {
$this->usages[$namespace] = new CodeUsage($namespace, $environment);
} else {
$this->usages[$namespace]->registerUsageInEnvironment($environment);
}
}
Signup or Login in order to comment.