public static function getHighlighter($highlighter = null, array $arguments = [])
    {
        if ($highlighter instanceof HighlighterInterface) {
            return $highlighter;
        }

        switch ($highlighter) {
            case 'pygments':
            case null:
                $highlighterClass = PygmentsHighlighter::class;
                break;
            default:
                // A different class name must have been specified
                $highlighterClass = (string) $highlighter;
                break;
        }

        try {
            $reflection = new \ReflectionClass($highlighterClass);
        } catch (\ReflectionException $e) {
            throw new \RuntimeException($e->getMessage());
        }

        if ($reflection->implementsInterface(HighlighterInterface::class)) {
            return $reflection->newInstanceArgs($arguments);
        }

        throw new \RuntimeException(
            sprintf(
                "'%s' must be an instance of '%s'.",
                $highlighterClass,
                HighlighterInterface::class
            )
        );
    }