public function registerCustomRenderer($callback, array $args = null):Renderer
    {
        if (is_callable($callback)) {
            $end = substr($callback, (strlen($callback) - 8));
            if ($end === "Renderer") {
                $this->display_elements["custom"] = $callback;
                $this->display_elements["args"] = $args;
                return ($this);
            } else {
                throw new Server500(new \ArrayObject(array("explain" =>
                    "Renderer name must be contain [Renderer] keyword at the end to be valid : $callback",
                    "solution" => "Please set a valid renderer name")));
            }
        } else {
            throw new Server500(new \ArrayObject(array("explain" =>
                "Cannot register $callback custom renderer : Is not callable", "solution" =>
                "Please set a callable renderer")));
        }
    }
public function registerCustomRenderer($callback, array $args = null):Renderer
    {
        if (is_callable($callback)) {
            $end = substr($callback, (strlen($callback) - 8));
            if ($end === "Renderer") {
                $this->display_elements["custom"] = $callback;
                $this->display_elements["args"] = $args;
                return ($this);
            } else {
                throw new Server500(new \ArrayObject(array("explain" =>
                    "Renderer name must be contain [Renderer] keyword at the end to be valid : $callback",
                    "solution" => "Please set a valid renderer name")));
            }
        } else {
            throw new Server500(new \ArrayObject(array("explain" =>
                "Cannot register $callback custom renderer : Is not callable", "solution" =>
                "Please set a callable renderer")));
        }
    }
public function registerCustomRenderer ( $ callback , array $ args = null ) : Renderer { if ( is_callable ( $ callback ) ) { $ end = substr ( $ callback , ( strlen ( $ callback ) - 8 ) ) ; if ( $ end === "Renderer" ) { $ this -> display_elements [ "custom" ] = $ callback ; $ this -> display_elements [ "args" ] = $ args ; return ( $ this ) ; } else { throw new Server500 ( new \ ArrayObject ( array ( "explain" => "Renderer name must be contain [Renderer] keyword at the end to be valid : $callback" , "solution" => "Please set a valid renderer name" ) ) ) ; } } else { throw new Server500 ( new \ ArrayObject ( array ( "explain" => "Cannot register $callback custom renderer : Is not callable" , "solution" => "Please set a callable renderer" ) ) ) ; } }
Register a custom renderer
@param $callback mixed The callable function (the renderer type)
@param array|null $args Arguments required for the callback
@return Renderer A renderer object
@throws Server500 If renderer is not callable
Register a custom renderer