0 follower

Class Yiisoft\YiiDevTool\Infrastructure\CodeUsage\NamespaceUsageFinder

InheritanceYiisoft\YiiDevTool\Infrastructure\CodeUsage\NamespaceUsageFinder

Method Details

Hide inherited methods

addTargetPaths() public method

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;
}

            
getUsages() public method

public Yiisoft\YiiDevTool\Infrastructure\CodeUsage\CodeUsage[] getUsages ( )

                public function getUsages(): array
{
    if ($this->usages === null) {
        $this->find();
    }
    return $this->usages;
}

            
registerNamespaceUsage() public method

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);
    }
}