public function add($name, GeneratorInterface $class)
    {
        if (array_key_exists($name, $this->generators)) {
            throw new \InvalidArgumentException('Generator already exists.');
        }

        $this->generators[$name] = $class;
    }
public function add($name, GeneratorInterface $class)
    {
        if (array_key_exists($name, $this->generators)) {
            throw new \InvalidArgumentException('Generator already exists.');
        }

        $this->generators[$name] = $class;
    }
public function add ( $ name , GeneratorInterface $ class ) { if ( array_key_exists ( $ name , $ this -> generators ) ) { throw new \ InvalidArgumentException ( 'Generator already exists.' ) ; } $ this -> generators [ $ name ] = $ class ; }
Add a generator to the factory

@param string               $name   the name of the Generator
@param GeneratorInterface   $class  the generator object to return for the specified name
Add a generator to the factory