public function addMethod($name, Closure $closure)
    {
        if (method_exists($this, $name)) {
            throw new Exception('Overriding core methods not allowed.');
        }

        $this->methods[$name] = $closure;
    }