private function guardLanguages(
        string $sourceLanguage,
        string $targetLanguage,
        DictionaryInterface $dictionary
    ): void {
        if ($dictionary->getSourceLanguage() !== $sourceLanguage
            || $dictionary->getTargetLanguage() !== $targetLanguage) {
            throw new LanguageMismatchException(
                $sourceLanguage,
                $dictionary->getSourceLanguage(),
                $targetLanguage,
                $dictionary->getTargetLanguage()
            );
        }
    }