ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
PostDataFromServerRequest.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 2017 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4 
6 
8 
10 
16 {
17 
21  protected $parsed_body;
22 
23 
25  {
26  $this->parsed_body = $request->getParsedBody();
27  }
28 
29 
33  public function get($name)
34  {
35  if (!isset($this->parsed_body[$name])) {
36  throw new \LogicException("'$name' is not contained in posted data.");
37  }
38 
39  return $this->parsed_body[$name];
40  }
41 
42 
46  public function getOr($name, $default)
47  {
48  if (!isset($this->parsed_body[$name])) {
49  return $default;
50  }
51 
52  return $this->parsed_body[$name];
53  }
54 }
Representation of an incoming, server-side HTTP request.
foreach($paths as $path) $request
Definition: asyncclient.php:32
getParsedBody()
Retrieve any parameters provided in the request body.
Implements interaction of input element with post data from psr-7 server request. ...
Describes how Input-Elements want to interact with posted data.
Definition: PostData.php:12
$default
Definition: build.php:20