ILIAS  trunk Revision v11.0_alpha-2658-ge2404539063
ILIAS\Data\Description\DList Class Reference
+ Inheritance diagram for ILIAS\Data\Description\DList:
+ Collaboration diagram for ILIAS\Data\Description\DList:

Public Member Functions

 __construct (Text\SimpleDocumentMarkdown $description, protected Description $value_type)
 
 getPrimitiveRepresentation (mixed $data)
 
 getValueType ()
 
- Public Member Functions inherited from ILIAS\Data\Description\Description
 __construct (protected ?Text\SimpleDocumentMarkdown $description,)
 
 getDescription ()
 
 getPrimitiveRepresentation (mixed $data)
 Each of the types that can be described has a canonical representation created from primitive PHP types. More...
 
 matches (mixed $data)
 

Detailed Description

Definition at line 25 of file DList.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Data\Description\DList::__construct ( Text\SimpleDocumentMarkdown  $description,
protected Description  $value_type 
)

Definition at line 29 of file DList.php.

References ILIAS\GlobalScreen\Provider\__construct().

32  {
33  parent::__construct($description);
34  }
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ getPrimitiveRepresentation()

ILIAS\Data\Description\DList::getPrimitiveRepresentation ( mixed  $data)

Definition at line 36 of file DList.php.

36  : mixed
37  {
38  if (!is_array($data)) {
39  return fn() => yield "Expected an array.";
40  }
41 
42  $repr = [];
43  $errors = [];
44 
45  foreach ($data as $v) {
46  $value = $this->value_type->getPrimitiveRepresentation($v);
47 
48  if ($value instanceof \Closure) {
49  $errors[] = $value;
50  } else {
51  $repr[] = $value;
52  }
53  }
54 
55  if ($errors) {
56  return $this->mergeErrors($errors);
57  }
58 
59  return $repr;
60  }

◆ getValueType()

ILIAS\Data\Description\DList::getValueType ( )

Definition at line 62 of file DList.php.

62  : Description
63  {
64  return $this->value_type;
65  }

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