public function getTranslatedByMethod(ValueObject $object, $method, $forcedLanguage = null)
    {
        if (!method_exists($object, $method)) {
            throw new InvalidArgumentException('$method', "Method '{$method}' not found on " . get_class($object));
        }

        foreach ($this->getLanguages($forcedLanguage) as $lang) {
            if ($value = $object->$method($lang)) {
                return $value;
            }
        }
    }
public function getTranslatedByMethod(ValueObject $object, $method, $forcedLanguage = null)
    {
        if (!method_exists($object, $method)) {
            throw new InvalidArgumentException('$method', "Method '{$method}' not found on " . get_class($object));
        }

        foreach ($this->getLanguages($forcedLanguage) as $lang) {
            if ($value = $object->$method($lang)) {
                return $value;
            }
        }
    }
public function getTranslatedByMethod ( ValueObject $ object , $ method , $ forcedLanguage = null ) { if ( ! method_exists ( $ object , $ method ) ) { throw new InvalidArgumentException ( '$method' , "Method '{$method}' not found on " . get_class ( $ object ) ) ; } foreach ( $ this -> getLanguages ( $ forcedLanguage ) as $ lang ) { if ( $ value = $ object -> $ method ( $ lang ) ) { return $ value ; } } }
Gets translated method generic helper.

For generic use, expects method exposing translated property as-is on value object, typically $object->$method($language)

Languages will consist of either forced language or current languages list, in addition helper will append null
to list of languages so method may fallback to main/initial language if supported by domain.

@param \eZ\Publish\API\Repository\Values\ValueObject $object  Can be any kind of Value object which directly holds the methods that provides translated value.
@param string $method Method name, example 'getName', 'description'
@param string $forcedLanguage Locale we want the content name translation in (e.g. "fre-FR"). Null by default (takes current locale)

@throws InvalidArgumentException

@return string|null
Gets translated method generic helper .