Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

UserParser.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\REST\Server\Input\Parser\FacetBuilder;
8
9 use eZ\Publish\Core\REST\Common\Input\BaseParser;
10 use eZ\Publish\Core\REST\Common\Input\ParsingDispatcher;
11 use eZ\Publish\Core\REST\Common\Exceptions;
12 use eZ\Publish\API\Repository\Values\Content\Query\FacetBuilder\UserFacetBuilder;
13
17 class UserParser extends BaseParser
18 {
29 public function parse(array $data, ParsingDispatcher $parsingDispatcher)
30 {
31 if (!array_key_exists('User', $data)) {
32 throw new Exceptions\Parser('Invalid <User> format');
33 }
34
35 $selectType = [
36 'OWNER' => UserFacetBuilder::OWNER,
37 'GROUP' => UserFacetBuilder::GROUP,
38 'MODIFIER' => UserFacetBuilder::MODIFIER,
39 ];
40
41 if (isset($data['User']['select'])) {
42 $type = $data['User']['select'];
43
44 if (!isset($selectType[$type])) {
45 throw new Exceptions\Parser('<User> unknown type (supported: ' . implode(', ', array_keys($selectType)) . ')');
46 }
47
48 $data['User']['type'] = $selectType[$type];
49
50 unset($data['User']['select']);
51 }
52
53 return new UserFacetBuilder($data['User']);
54 }
55 }
eZ\Publish\API\Repository\Values\Content\Query\FacetBuilder\UserFacetBuilder
Build a user facet.
Definition: UserFacetBuilder.php:17
eZ\Publish\API\Repository\Values\Content\Query\FacetBuilder\UserFacetBuilder\GROUP
const GROUP
Owner user group.
Definition: UserFacetBuilder.php:26
eZ\Publish\API\Repository\Values\Content\Query\FacetBuilder\UserFacetBuilder\MODIFIER
const MODIFIER
Modifier.
Definition: UserFacetBuilder.php:31
eZ\Publish\API\Repository\Values\Content\Query\FacetBuilder\UserFacetBuilder\OWNER
const OWNER
Owner user.
Definition: UserFacetBuilder.php:21
eZ\Publish\Core\REST\Common\Input\BaseParser
Definition: BaseParser.php:12
eZ\Publish\Core\REST\Common\Input\ParsingDispatcher
Parsing dispatcher.
Definition: ParsingDispatcher.php:15
eZ\Publish\Core\REST\Server\Input\Parser\FacetBuilder\UserParser
Parser for User facet builder.
Definition: UserParser.php:18
eZ\Publish\Core\REST\Server\Input\Parser\FacetBuilder\UserParser\parse
parse(array $data, ParsingDispatcher $parsingDispatcher)
Parses input structure to a FacetBuilder object.
Definition: UserParser.php:29
eZ\Publish\Core\REST\Common\Exceptions
Definition: Core/REST/Common/Exceptions/ForbiddenException.php:7
eZ\Publish\Core\REST\Server\Input\Parser\FacetBuilder
Definition: ContentTypeParser.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.