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...
 

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.

References $values.

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

Member Function Documentation

◆ get()

DefPostData::get (   $name)

Get a named value from the data.

Parameters
string$name
Exceptions

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

Definition at line 61 of file InputTest.php.

References ILIAS\UI\Implementation\Component\Input\Field\Input\$name.

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  }

◆ 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.

References ILIAS\UI\Implementation\Component\Input\Field\Input\$name, and ILIAS\UI\Implementation\Component\Input\Field\Input\$value.

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  }

Field Documentation

◆ $values

DefPostData::$values = array()

Definition at line 52 of file InputTest.php.


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