public function getHandler(string $handler): Handler
    {
        if (!isset($this->handlers[$handler])) {
            if (!class_exists($handler) || !class_implements($handler, Handler::class)) {
                throw new \RuntimeException("No handler found for '$handler'.");
            }

            $instance = new $handler();
            $this->handlers[$handler] = $instance;
        } else {
            $instance = $this->handlers[$handler];
        }

        return $instance;
    }