eZ\Publish\Core\REST\Server\Input\Parser\SectionInput::parse PHP Метод

parse() публичный Метод

Parse input structure.
public parse ( array $data, ParsingDispatcher $parsingDispatcher ) : eZ\Publish\API\Repository\Values\Content\SectionCreateStruct
$data array
$parsingDispatcher eZ\Publish\Core\REST\Common\Input\ParsingDispatcher
Результат eZ\Publish\API\Repository\Values\Content\SectionCreateStruct
    public function parse(array $data, ParsingDispatcher $parsingDispatcher)
    {
        $sectionCreate = $this->sectionService->newSectionCreateStruct();
        //@todo XSD says that name is not mandatory? Does that make sense?
        if (!array_key_exists('name', $data)) {
            throw new Exceptions\Parser("Missing 'name' attribute for SectionInput.");
        }
        $sectionCreate->name = $data['name'];
        //@todo XSD says that identifier is not mandatory? Does that make sense?
        if (!array_key_exists('identifier', $data)) {
            throw new Exceptions\Parser("Missing 'identifier' attribute for SectionInput.");
        }
        $sectionCreate->identifier = $data['identifier'];
        return $sectionCreate;
    }