Yosymfony\Spress\Core\ContentManager\Generator\GeneratorManager::getGenerator PHP Méthode

getGenerator() public méthode

Gets a generator.
public getGenerator ( string $name ) : Yosymfony\Spress\Core\ContentManager\Generator\GeneratorInterface
$name string The generator name
Résultat Yosymfony\Spress\Core\ContentManager\Generator\GeneratorInterface
    public function getGenerator($name)
    {
        if ($this->hasGenerator($name) === false) {
            throw new \RuntimeException(sprintf('Generator not found: "%s".', $name));
        }
        return $this->generators[$name];
    }

Usage Example

 /**
  * @expectedException \RuntimeException
  */
 public function testGeneratorNotFound()
 {
     $generator = new PaginationGenerator();
     $gm = new GeneratorManager();
     $gm->addGenerator('paginator', $generator);
     $gm->getGenerator('paginator-1');
 }