SensioLabs\Deptrac\CollectorFactory::getCollector PHP Метод

getCollector() публичный Метод

public getCollector ( $type ) : SensioLabs\Deptrac\Collector\CollectorInterface
$type
Результат SensioLabs\Deptrac\Collector\CollectorInterface
    public function getCollector($type)
    {
        if (!isset($this->collectors[$type])) {
            throw new \InvalidArgumentException(sprintf('unknown collector type "%s", possible collectors are %s', $type, implode(', ', array_keys($this->collectors))));
        }
        return $this->collectors[$type];
    }

Usage Example

 public function getLayersByClassName($className)
 {
     $layers = [];
     foreach ($this->configuration->getLayers() as $configurationLayer) {
         foreach ($configurationLayer->getCollectors() as $configurationCollector) {
             $collector = $this->collectorFactory->getCollector($configurationCollector->getType());
             if (!($astClassReference = $this->astMap->getClassReferenceByClassName($className))) {
                 $astClassReference = new AstClassReference($className);
             }
             if ($collector->satisfy($configurationCollector->getArgs(), $astClassReference, $this->astMap, $this->collectorFactory, $this->astParser)) {
                 $layers[$configurationLayer->getName()] = true;
             }
         }
     }
     return array_keys($layers);
 }