public function addFunction($name, $callback) {
        if (!is_callable($callback)) {
            throw new InvalidArgumentException(sprintf(
                'Callback provided for function "%s" is not callable.',
                $name
            ));
        }

        $this->functions[$name] = $callback;

        return $this;
    }