code: public function add($name, $template)
      {
          if (array_key_exists($name, $this->templates)) {
              throw new \InvalidArgumentException('Template already exists.');
          }
  
          $this->templates[$name] = $template;
      }
docs: Add a template to the factory
  
  @param string   $name      the name of the Generator
  @param string   $template  the template to return for the specified name