eZ\Bundle\EzPublishDebugBundle\Collector\EzPublishCoreCollector::getCollector PHP Method

getCollector() public method

public getCollector ( string $name ) : Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface
$name string Name of the collector
return Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface
    public function getCollector($name)
    {
        if (!isset($this->data['collectors'][$name])) {
            throw new InvalidArgumentException("Invalid debug collector '{$name}'");
        }
        return $this->data['collectors'][$name];
    }

Usage Example

 /**
  * @expectedException \InvalidArgumentException
  */
 public function testGetInvalidCollector()
 {
     $collector = $this->getMock('\\Symfony\\Component\\HttpKernel\\DataCollector\\DataCollectorInterface');
     $this->mainCollector->addCollector($collector);
     $this->assertSame($collector, $this->mainCollector->getCollector('foo'));
 }