public function translate($languageIdentifier, TranslateableInterface $object)
    {
        $deepCopy = new DeepCopy();
        $object = $deepCopy->copy($object);

        /**
         * @var Translation[] $translations
         */
        $translations = array_filter($object->getTranslations(), function (Translation $translation) use ($languageIdentifier) {
            return $translation->getLanguageIdentifier() === $languageIdentifier;
        });

        if (empty($translations)) {
            return $object;
        }

        foreach ($translations as $translation) {
            $method = 'set' . ucfirst($translation->getProperty());

            if (method_exists($object, $method)) {
                $object->$method($translation->getValue());
            }
        }

        return $object;
    }
public function translate($languageIdentifier, TranslateableInterface $object)
    {
        $deepCopy = new DeepCopy();
        $object = $deepCopy->copy($object);

        /**
         * @var Translation[] $translations
         */
        $translations = array_filter($object->getTranslations(), function (Translation $translation) use ($languageIdentifier) {
            return $translation->getLanguageIdentifier() === $languageIdentifier;
        });

        if (empty($translations)) {
            return $object;
        }

        foreach ($translations as $translation) {
            $method = 'set' . ucfirst($translation->getProperty());

            if (method_exists($object, $method)) {
                $object->$method($translation->getValue());
            }
        }

        return $object;
    }
{@inheritdoc}