src/Smf/Menu/Renderer/Manager.php
public function addRenderer($name, $renderer, $overwrite = false)
    {
        if (isset($this->renderers[$name]) && !$overwrite) {
            throw new InvalidArgumentException("Renderer with name '$name' is already registered.");
        }
        unset($this->renderers[$name]);
        // Is class? Exists?
        if (is_string($renderer) && !class_exists($renderer)) {
            throw new InvalidArgumentException("Renderer class '$renderer' doesn't exist.");
        }
        $this->renderers[$name] = $renderer;
        return $this;
    }
public function addRenderer($name, $renderer, $overwrite = false)
    {
        if (isset($this->renderers[$name]) && !$overwrite) {
            throw new InvalidArgumentException("Renderer with name '$name' is already registered.");
        }
        unset($this->renderers[$name]);
        // Is class? Exists?
        if (is_string($renderer) && !class_exists($renderer)) {
            throw new InvalidArgumentException("Renderer class '$renderer' doesn't exist.");
        }
        $this->renderers[$name] = $renderer;
        return $this;
    }
public function addRenderer ( $ name , $ renderer , $ overwrite = false ) { if ( isset ( $ this -> renderers [ $ name ] ) && ! $ overwrite ) { throw new InvalidArgumentException ( "Renderer with name '$name' is already registered." ) ; } unset ( $ this -> renderers [ $ name ] ) ; // Is class? Exists? if ( is_string ( $ renderer ) && ! class_exists ( $ renderer ) ) { throw new InvalidArgumentException ( "Renderer class '$renderer' doesn't exist." ) ; } $ this -> renderers [ $ name ] = $ renderer ; return $ this ; }
Ads renderer with given name
@param string $name Name of the renderer
@param string|IRenderer $renderer Renderer class name or instance
@param bool $overwrite Should be overwritten renderer with this name if exists?
@return IManager Fluent interface
@throws InvalidArgumentException If the renderer with given name already exists and $overwrite is false
Ads renderer with given name