eZ\Publish\Core\REST\Server\Input\Parser\ObjectStateGroupUpdate::parse PHP Method

parse() public method

Parse input structure.
public parse ( array $data, ParsingDispatcher $parsingDispatcher ) : eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroupUpdateStruct
$data array
$parsingDispatcher eZ\Publish\Core\REST\Common\Input\ParsingDispatcher
return eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroupUpdateStruct
    public function parse(array $data, ParsingDispatcher $parsingDispatcher)
    {
        $objectStateGroupUpdateStruct = $this->objectStateService->newObjectStateGroupUpdateStruct();
        if (array_key_exists('identifier', $data)) {
            $objectStateGroupUpdateStruct->identifier = $data['identifier'];
        }
        if (array_key_exists('defaultLanguageCode', $data)) {
            $objectStateGroupUpdateStruct->defaultLanguageCode = $data['defaultLanguageCode'];
        }
        if (array_key_exists('names', $data)) {
            if (!is_array($data['names'])) {
                throw new Exceptions\Parser("Missing or invalid 'names' element for ObjectStateGroupUpdate.");
            }
            if (!array_key_exists('value', $data['names']) || !is_array($data['names']['value'])) {
                throw new Exceptions\Parser("Missing or invalid 'names' element for ObjectStateGroupUpdate.");
            }
            $objectStateGroupUpdateStruct->names = $this->parserTools->parseTranslatableList($data['names']);
        }
        if (array_key_exists('descriptions', $data) && is_array($data['descriptions'])) {
            $objectStateGroupUpdateStruct->descriptions = $this->parserTools->parseTranslatableList($data['descriptions']);
        }
        return $objectStateGroupUpdateStruct;
    }
ObjectStateGroupUpdate