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

Publish/Core/REST/Server/Controller.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\REST\Server;
8
9 use eZ\Publish\API\Repository\Repository;
10 use Symfony\Component\DependencyInjection\ContainerAwareInterface;
11 use Symfony\Component\DependencyInjection\ContainerAwareTrait;
12 use Symfony\Component\Routing\RouterInterface;
13 use eZ\Publish\Core\REST\Common\Input\Dispatcher as InputDispatcher;
14 use Symfony\Component\HttpFoundation\Request;
15 use eZ\Publish\Core\REST\Common\RequestParser;
16
17 abstract class Controller implements ContainerAwareInterface
18 {
19 use ContainerAwareTrait;
20
22 protected $inputDispatcher;
23
25 protected $router;
26
28 protected $requestParser;
29
35 protected $repository;
36
37 public function setInputDispatcher(InputDispatcher $inputDispatcher)
38 {
39 $this->inputDispatcher = $inputDispatcher;
40 }
41
42 public function setRouter(RouterInterface $router)
43 {
44 $this->router = $router;
45 }
46
47 public function setRepository(Repository $repository)
48 {
49 $this->repository = $repository;
50 }
51
52 public function setRequestParser(RequestParser $requestParser)
53 {
54 $this->requestParser = $requestParser;
55 }
56
64 protected function getMediaType(Request $request)
65 {
66 foreach ($request->getAcceptableContentTypes() as $mimeType) {
67 if (preg_match('(^([a-z0-9-/.]+)\+.*$)', strtolower($mimeType), $matches)) {
68 return $matches[1];
69 }
70 }
71
72 return 'unknown/unknown';
73 }
74 }
eZ\Publish\Core\REST\Common\Input\Dispatcher
Input dispatcher.
Definition: Dispatcher.php:16
eZ\Publish\Core\REST\Server\Controller
Definition: Publish/Core/REST/Server/Controller.php:18
eZ\Publish\Core\REST\Server\Controller\$repository
$repository
Definition: Publish/Core/REST/Server/Controller.php:35
eZ\Publish\Core\REST\Server\Controller\setRouter
setRouter(RouterInterface $router)
Definition: Publish/Core/REST/Server/Controller.php:42
eZ\Publish\Core\REST\Server\Controller\$requestParser
$requestParser
Definition: Publish/Core/REST/Server/Controller.php:28
eZ\Publish\Core\REST\Server\Controller\setRepository
setRepository(Repository $repository)
Definition: Publish/Core/REST/Server/Controller.php:47
eZ\Publish\Core\REST\Server\Controller\$router
$router
Definition: Publish/Core/REST/Server/Controller.php:25
eZ\Publish\Core\REST\Server\Controller\setInputDispatcher
setInputDispatcher(InputDispatcher $inputDispatcher)
Definition: Publish/Core/REST/Server/Controller.php:37
eZ\Publish\Core\REST\Server\Controller\$inputDispatcher
$inputDispatcher
Definition: Publish/Core/REST/Server/Controller.php:22
eZ\Publish\Core\REST\Server\Controller\setRequestParser
setRequestParser(RequestParser $requestParser)
Definition: Publish/Core/REST/Server/Controller.php:52
eZ\Publish\Core\REST\Server\Controller\getMediaType
getMediaType(Request $request)
Extracts the requested media type from $request.
Definition: Publish/Core/REST/Server/Controller.php:64
eZ\Publish\API\Repository\Repository
Repository interface.
Definition: API/Repository/Repository.php:16
eZ\Publish\Core\REST\Common\RequestParser
Interface for Request parsers.
Definition: RequestParser.php:13
eZ\Publish\Core\REST\Common\RequestParser
Definition: EzPublish.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.