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

Session.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\BaseParser;
10 use eZ\Publish\Core\REST\Common\Input\ParserTools;
11 use eZ\Publish\Core\REST\Common\Input\ParsingDispatcher;
12 use eZ\Publish\Core\REST\Server\Values;
13 use eZ\Publish\API\Repository\UserService;
14
18 class Session extends BaseParser
19 {
21 protected $parserTools;
22
28 protected $userService;
29
34 public function __construct(ParserTools $parserTools, UserService $userService)
35 {
36 $this->parserTools = $parserTools;
37 $this->userService = $userService;
38 }
39
50 public function parse(array $data, ParsingDispatcher $parsingDispatcher)
51 {
52 if (!array_key_exists('_href', $data['User'])) {
53 throw new Exceptions\Parser("Missing '_href' attribute for User element in Session.");
54 }
55
56 $userId = $this->requestParser->parseHref($data['User']['_href'], 'userId');
57
58 $user = $this->userService->loadUser($userId);
59
60 return new Values\UserSession(
61 $user,
62 $data['name'],
63 $data['identifier'],
64 $data['csrfToken'],
65 null
66 );
67 }
68 }
eZ\Publish\Core\REST\Client\Input\Parser\Session
Value for Session.
Definition: Session.php:19
eZ\Publish\Core\REST\Client\Input\Parser\Session\$userService
$userService
Definition: Session.php:28
eZ\Publish\Core\REST\Client\Input\Parser\Session\parse
parse(array $data, ParsingDispatcher $parsingDispatcher)
Parse input structure.
Definition: Session.php:50
eZ\Publish\Core\REST\Client\Input\Parser\Session\$parserTools
$parserTools
Definition: Session.php:21
eZ\Publish\Core\REST\Client\Input\Parser\Session\__construct
__construct(ParserTools $parserTools, UserService $userService)
Definition: Session.php:34
eZ\Publish\Core\REST\Common\Input\BaseParser
Definition: BaseParser.php:12
eZ\Publish\Core\REST\Common\Input\ParserTools
Tools object to be used in Input Parsers.
Definition: ParserTools.php:17
eZ\Publish\Core\REST\Common\Input\ParsingDispatcher
Parsing dispatcher.
Definition: ParsingDispatcher.php:15
eZ\Publish\API\Repository\UserService
Definition: API/Repository/UserService.php:26
eZ\Publish\Core\REST\Client\Input\Parser
Definition: Publish/Core/REST/Client/Input/Parser/Content.php:7
eZ\Publish\Core\REST\Server\Values
Definition: Core/REST/Server/Values/BookmarkList.php:9
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.