protected function buildObjectStateUpdateInputStruct(APIObjectState $objectState, $identifier, $defaultLanguageCode, $names, $descriptions)
    {
        $inputStruct = new InputStruct();

        if ($identifier !== null && (!is_string($identifier) || empty($identifier))) {
            throw new InvalidArgumentValue('identifier', $identifier);
        }

        $inputStruct->identifier = $identifier !== null ? $identifier : $objectState->identifier;

        if ($defaultLanguageCode !== null && (!is_string($defaultLanguageCode) || empty($defaultLanguageCode))) {
            throw new InvalidArgumentValue('defaultLanguageCode', $defaultLanguageCode);
        }

        $inputStruct->defaultLanguage = $defaultLanguageCode !== null ? $defaultLanguageCode : $objectState->defaultLanguageCode;

        if ($names !== null && (!is_array($names) || empty($names))) {
            throw new InvalidArgumentValue('names', $names);
        }

        $inputStruct->name = $names !== null ? $names : $objectState->getNames();

        if (!isset($inputStruct->name[$inputStruct->defaultLanguage])) {
            throw new InvalidArgumentValue('names', $inputStruct->name);
        }

        foreach ($inputStruct->name as $languageCode => $name) {
            try {
                $this->repository->getContentLanguageService()->loadLanguage($languageCode);
            } catch (NotFoundException $e) {
                throw new InvalidArgumentValue('names', $inputStruct->name);
            }

            if (!is_string($name) || empty($name)) {
                throw new InvalidArgumentValue('names', $inputStruct->name);
            }
        }

        if ($descriptions !== null && !is_array($descriptions)) {
            throw new InvalidArgumentValue('descriptions', $descriptions);
        }

        $descriptions = $descriptions !== null ? $descriptions : $objectState->getDescriptions();
        $descriptions = $descriptions !== null ? $descriptions : array();

        $inputStruct->description = array();
        foreach ($inputStruct->name as $languageCode => $name) {
            if (isset($descriptions[$languageCode]) && !empty($descriptions[$languageCode])) {
                $inputStruct->description[$languageCode] = $descriptions[$languageCode];
            } else {
                $inputStruct->description[$languageCode] = '';
            }
        }

        return $inputStruct;
    }
protected function buildObjectStateUpdateInputStruct(APIObjectState $objectState, $identifier, $defaultLanguageCode, $names, $descriptions)
    {
        $inputStruct = new InputStruct();

        if ($identifier !== null && (!is_string($identifier) || empty($identifier))) {
            throw new InvalidArgumentValue('identifier', $identifier);
        }

        $inputStruct->identifier = $identifier !== null ? $identifier : $objectState->identifier;

        if ($defaultLanguageCode !== null && (!is_string($defaultLanguageCode) || empty($defaultLanguageCode))) {
            throw new InvalidArgumentValue('defaultLanguageCode', $defaultLanguageCode);
        }

        $inputStruct->defaultLanguage = $defaultLanguageCode !== null ? $defaultLanguageCode : $objectState->defaultLanguageCode;

        if ($names !== null && (!is_array($names) || empty($names))) {
            throw new InvalidArgumentValue('names', $names);
        }

        $inputStruct->name = $names !== null ? $names : $objectState->getNames();

        if (!isset($inputStruct->name[$inputStruct->defaultLanguage])) {
            throw new InvalidArgumentValue('names', $inputStruct->name);
        }

        foreach ($inputStruct->name as $languageCode => $name) {
            try {
                $this->repository->getContentLanguageService()->loadLanguage($languageCode);
            } catch (NotFoundException $e) {
                throw new InvalidArgumentValue('names', $inputStruct->name);
            }

            if (!is_string($name) || empty($name)) {
                throw new InvalidArgumentValue('names', $inputStruct->name);
            }
        }

        if ($descriptions !== null && !is_array($descriptions)) {
            throw new InvalidArgumentValue('descriptions', $descriptions);
        }

        $descriptions = $descriptions !== null ? $descriptions : $objectState->getDescriptions();
        $descriptions = $descriptions !== null ? $descriptions : array();

        $inputStruct->description = array();
        foreach ($inputStruct->name as $languageCode => $name) {
            if (isset($descriptions[$languageCode]) && !empty($descriptions[$languageCode])) {
                $inputStruct->description[$languageCode] = $descriptions[$languageCode];
            } else {
                $inputStruct->description[$languageCode] = '';
            }
        }

        return $inputStruct;
    }
protected function buildObjectStateUpdateInputStruct ( APIObjectState $ objectState , $ identifier , $ defaultLanguageCode , $ names , $ descriptions ) { $ inputStruct = new InputStruct ( ) ; if ( $ identifier !== null && ( ! is_string ( $ identifier ) || empty ( $ identifier ) ) ) { throw new InvalidArgumentValue ( 'identifier' , $ identifier ) ; } $ inputStruct -> identifier = $ identifier !== null ? $ identifier : $ objectState -> identifier ; if ( $ defaultLanguageCode !== null && ( ! is_string ( $ defaultLanguageCode ) || empty ( $ defaultLanguageCode ) ) ) { throw new InvalidArgumentValue ( 'defaultLanguageCode' , $ defaultLanguageCode ) ; } $ inputStruct -> defaultLanguage = $ defaultLanguageCode !== null ? $ defaultLanguageCode : $ objectState -> defaultLanguageCode ; if ( $ names !== null && ( ! is_array ( $ names ) || empty ( $ names ) ) ) { throw new InvalidArgumentValue ( 'names' , $ names ) ; } $ inputStruct -> name = $ names !== null ? $ names : $ objectState -> getNames ( ) ; if ( ! isset ( $ inputStruct -> name [ $ inputStruct -> defaultLanguage ] ) ) { throw new InvalidArgumentValue ( 'names' , $ inputStruct -> name ) ; } foreach ( $ inputStruct -> name as $ languageCode => $ name ) { try { $ this -> repository -> getContentLanguageService ( ) -> loadLanguage ( $ languageCode ) ; } catch ( NotFoundException $ e ) { throw new InvalidArgumentValue ( 'names' , $ inputStruct -> name ) ; } if ( ! is_string ( $ name ) || empty ( $ name ) ) { throw new InvalidArgumentValue ( 'names' , $ inputStruct -> name ) ; } } if ( $ descriptions !== null && ! is_array ( $ descriptions ) ) { throw new InvalidArgumentValue ( 'descriptions' , $ descriptions ) ; } $ descriptions = $ descriptions !== null ? $ descriptions : $ objectState -> getDescriptions ( ) ; $ descriptions = $ descriptions !== null ? $ descriptions : array ( ) ; $ inputStruct -> description = array ( ) ; foreach ( $ inputStruct -> name as $ languageCode => $ name ) { if ( isset ( $ descriptions [ $ languageCode ] ) && ! empty ( $ descriptions [ $ languageCode ] ) ) { $ inputStruct -> description [ $ languageCode ] = $ descriptions [ $ languageCode ] ; } else { $ inputStruct -> description [ $ languageCode ] = '' ; } } return $ inputStruct ; }
Validates input for updating object states and builds the InputStruct object.

@param \eZ\Publish\API\Repository\Values\ObjectState\ObjectState $objectState
@param string $identifier
@param string $defaultLanguageCode
@param string[] $names
@param string[] $descriptions

@return \eZ\Publish\SPI\Persistence\Content\ObjectState\InputStruct
Validates input for updating object states and builds the InputStruct object .