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

Core/REST/Server/Input/Parser/Criterion/UserMetadata.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\REST\Server\Input\Parser\Criterion;
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\Criterion\UserMetadata as UserMetadataCriterion;
13
17 class UserMetadata extends BaseParser
18 {
29 public function parse(array $data, ParsingDispatcher $parsingDispatcher)
30 {
31 if (!isset($data['UserMetadataCriterion'])) {
32 throw new Exceptions\Parser('Invalid <UserMetadataCriterion> format');
33 }
34
35 if (!isset($data['UserMetadataCriterion']['Target'])) {
36 throw new Exceptions\Parser('Invalid <Target> format');
37 }
38
39 $target = $data['UserMetadataCriterion']['Target'];
40
41 if (!isset($data['UserMetadataCriterion']['Value'])) {
42 throw new Exceptions\Parser('Invalid <Value> format');
43 }
44
45 if (!in_array(gettype($data['UserMetadataCriterion']['Value']), ['integer', 'string', 'array'])) {
46 throw new Exceptions\Parser('Invalid <Value> format');
47 }
48
49 $value = is_array($data['UserMetadataCriterion']['Value'])
50 ? $data['UserMetadataCriterion']['Value']
51 : explode(',', $data['UserMetadataCriterion']['Value']);
52
53 return new UserMetadataCriterion($target, null, $value);
54 }
55 }
eZ\Publish\API\Repository\Values\Content\Query\Criterion\UserMetadata
A criterion that matches content based on one of the user metadata (owner, group, modifier).
Definition: API/Repository/Values/Content/Query/Criterion/UserMetadata.php:30
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\Criterion\UserMetadata
Parser for ViewInput.
Definition: Core/REST/Server/Input/Parser/Criterion/UserMetadata.php:18
eZ\Publish\Core\REST\Server\Input\Parser\Criterion\UserMetadata\parse
parse(array $data, ParsingDispatcher $parsingDispatcher)
Parses input structure to a Criterion object.
Definition: Core/REST/Server/Input/Parser/Criterion/UserMetadata.php:29
eZ\Publish\Core\REST\Common\Exceptions
Definition: Core/REST/Common/Exceptions/ForbiddenException.php:7
eZ\Publish\Core\REST\Server\Input\Parser\Criterion
Definition: Core/REST/Server/Input/Parser/Criterion/Ancestor.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.