src/Sulu/Component/Content/Compat/LocalizationFinder.php
private function findAvailableLocalization(array $availableLocales, array $localizations)
    {
        foreach ($localizations as $localization) {
            if (in_array($localization->getLocale(), $availableLocales)) {
                return $localization;
            }

            $children = $localization->getChildren();

            if ($children) {
                $result = $this->findAvailableLocalization($availableLocales, $children);

                if (null !== $result) {
                    return $result;
                }
            }
        }

        return;
    }
private function findAvailableLocalization(array $availableLocales, array $localizations)
    {
        foreach ($localizations as $localization) {
            if (in_array($localization->getLocale(), $availableLocales)) {
                return $localization;
            }

            $children = $localization->getChildren();

            if ($children) {
                $result = $this->findAvailableLocalization($availableLocales, $children);

                if (null !== $result) {
                    return $result;
                }
            }
        }

        return;
    }
private function findAvailableLocalization ( array $ availableLocales , array $ localizations ) { foreach ( $ localizations as $ localization ) { if ( in_array ( $ localization -> getLocale ( ) , $ availableLocales ) ) { return $ localization ; } $ children = $ localization -> getChildren ( ) ; if ( $ children ) { $ result = $ this -> findAvailableLocalization ( $ availableLocales , $ children ) ; if ( null !== $ result ) { return $ result ; } } } return ; }
Finds any localization, in which the node is translated.

@param string[] $availableLocales
@param Localization[] $localizations The available localizations

@return null|Localization
Finds any localization in which the node is translated .