ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
RequestParser.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use ILIAS\Refinery\Factory as Refinery;
26use ILIAS\MetaData\Paths\FactoryInterface as PathFactoryInterface;
27
29{
32 protected PathFactoryInterface $path_factory;
33
34 public function __construct(
37 PathFactoryInterface $path_factory
38 ) {
39 $this->http = $http;
40 $this->refinery = $refinery;
41 $this->path_factory = $path_factory;
42 }
43
44 public function fetchBasePath(): PathInterface
45 {
46 return $this->fetchPath(Parameter::BASE_PATH, false);
47 }
48
49 public function fetchActionPath(): PathInterface
50 {
51 return $this->fetchPath(Parameter::ACTION_PATH, true);
52 }
53
54 public function fetchRequestForForm(
55 bool $with_action_path
58 $request = $this->http->request(),
59 $with_action_path ? $this->fetchActionPath() : null
60 );
61 }
62
63 protected function fetchPath(
64 Parameter $parameter,
65 bool $throw_error
66 ): PathInterface {
67 $request_wrapper = $this->http->wrapper()->query();
68 if ($request_wrapper->has($parameter->value)) {
69 $path_string = $request_wrapper->retrieve(
70 $parameter->value,
71 $this->refinery->kindlyTo()->string()
72 );
73 return $this->path_factory->fromString(urldecode($path_string));
74 }
75 if ($throw_error) {
76 throw new \ilMDEditorException('Parameter not found.');
77 } else {
78 return $this->path_factory->custom()->get();
79 }
80 }
81}
Builds data types.
Definition: Factory.php:36
fetchRequestForForm(bool $with_action_path)
__construct(GlobalHttpState $http, Refinery $refinery, PathFactoryInterface $path_factory)
fetchPath(Parameter $parameter, bool $throw_error)
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface GlobalHttpState.
static http()
Fetches the global http state from ILIAS.