ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
DefPostData Class Reference
+ Inheritance diagram for DefPostData:
+ Collaboration diagram for DefPostData:

Public Member Functions

 __construct (array $values)
 
 get ($name)
 Get a named value from the data. More...
 
 getOr ($name, $value)
 Get a named value from the data and fallback to default if that name does not exist. More...
 
 get ($name)
 Get a named value from the data. More...
 
 getOr ($name, $default)
 Get a named value from the data and fallback to default if that name does not exist. More...
 

Data Fields

 $values = array()
 

Detailed Description

Definition at line 50 of file InputTest.php.

Constructor & Destructor Documentation

◆ __construct()

DefPostData::__construct ( array  $values)

Definition at line 55 of file InputTest.php.

56 {
57 $this->values = $values;
58 }

References $values.

Member Function Documentation

◆ get()

DefPostData::get (   $name)

Get a named value from the data.

Parameters
string$name
Exceptions

LogicException if name is not in data

Returns
mixed

Implements ILIAS\UI\Implementation\Component\Input\PostData.

Definition at line 61 of file InputTest.php.

62 {
63 if (!is_string($name)) {
64 throw new \InvalidArgumentException('$name is no string.');
65 }
66 if (!isset($this->values[$name])) {
67 throw new \LogicException("'$name' does not exist.");
68 }
69
70 return $this->values[$name];
71 }

References $name.

◆ getOr()

DefPostData::getOr (   $name,
  $default 
)

Get a named value from the data and fallback to default if that name does not exist.

Parameters
string$name
mixed$default
Returns
mixed

Implements ILIAS\UI\Implementation\Component\Input\PostData.

Definition at line 74 of file InputTest.php.

75 {
76 if (!is_string($name)) {
77 throw new \InvalidArgumentException('$name is no string.');
78 }
79 if (!isset($this->values[$name])) {
80 return $value;
81 }
82
83 return $this->values[$name];
84 }

References $name.

Field Documentation

◆ $values

DefPostData::$values = array()

Definition at line 52 of file InputTest.php.

Referenced by __construct().


The documentation for this class was generated from the following file: