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

Input/Parser/ViewResult.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\REST\Client\Input\Parser;
8
9 use eZ\Publish\Core\REST\Common\Input\ParsingDispatcher;
10 use eZ\Publish\Core\REST\Common\Exceptions;
11 use eZ\Publish\API\Repository\Values\Content\Query;
12 use eZ\Publish\Core\REST\Common\Input\BaseParser;
13 use eZ\Publish\Core\REST\Client\Values\ViewResult as ViewResultValue;
14
18 class ViewResult extends BaseParser
19 {
30 public function parse(array $data, ParsingDispatcher $parsingDispatcher)
31 {
32 $valueData = [];
33
34 if (!array_key_exists('searchHits', $data) || !is_array($data['searchHits'])) {
35 throw new Exceptions\Parser("Missing or invalid SearchHits in ViewResult data");
36 }
37
38 if (!array_key_exists('searchHit', $data['searchHits']) || !is_array($data['searchHits']['searchHit'])) {
39 throw new Exceptions\Parser("Missing or invalid searchHits.searchHit in ViewResult data");
40 }
41
42 $valueData['searchHits'] = [];
43 foreach ($data['searchHits']['searchHit'] as $searchHit) {
44 $valueData['searchHits'][] = $parsingDispatcher->parse($searchHit, $searchHit['_media-type']);
45 }
46
47 return new ViewResultValue($valueData);
48 }
49 }
eZ\Publish\API\Repository\Values\Content\Query
This class is used to perform a Content query.
Definition: API/Repository/Values/Content/Query.php:15
eZ\Publish\Core\REST\Client\Input\Parser\ViewResult
Parser for View.
Definition: Input/Parser/ViewResult.php:19
eZ\Publish\Core\REST\Client\Input\Parser\ViewResult\parse
parse(array $data, ParsingDispatcher $parsingDispatcher)
Parses input structure to a RestViewInput struct.
Definition: Input/Parser/ViewResult.php:30
eZ\Publish\Core\REST\Client\Values\ViewResult
Definition: Values/ViewResult.php:16
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\Common\Input\ParsingDispatcher\parse
parse(array $data, $mediaType)
Parses the given $data according to $mediaType.
Definition: ParsingDispatcher.php:66
eZ\Publish\Core\REST\Client\Input\Parser
Definition: Publish/Core/REST/Client/Input/Parser/Content.php:7
eZ\Publish\Core\REST\Common\Exceptions
Definition: Core/REST/Common/Exceptions/ForbiddenException.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.