ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ComponentEntryDescription.php
Go to the documentation of this file.
1<?php
2
4
13{
17 protected $description = array(
18 "purpose"=>"",
19 "composition"=>"",
20 "effect"=>"",
21 "rivals"=>array()
22 );
23
28 public function __construct($description = array())
29 {
30 parent::__construct();
32 }
33
38 public function withDescription($description = array())
39 {
40 $clone = clone $this;
41 $clone->setDescription($description);
42 return $clone;
43 }
44
48 protected function setDescription($descriptionElements)
49 {
50 if (!$descriptionElements) {
51 return;
52 }
53 $this->assert()->isArray($descriptionElements);
54 foreach ($descriptionElements as $category => $element) {
55 $this->assert()->isIndex($category, $this->description);
56
57 if (is_array($this->description[$category])) {
58 if ($element && $element != "") {
59 $this->assert()->isArray($element);
60 foreach ($element as $key => $part) {
61 $this->assert()->isString($part);
62 $this->description[$category][$key] = $part;
63 }
64 }
65 } else {
66 $this->assert()->isString($element);
67 $this->description[$category] = $element;
68 }
69 }
70 }
71
75 public function getProperty($key)
76 {
77 $this->assert()->isIndex($key, $this->description);
78
79 return $this->description[$key];
80 }
81
85 public function getDescription()
86 {
87 return $this->description;
88 }
89
93 public function jsonSerialize()
94 {
95 return $this->getDescription();
96 }
97}
An exception for terminatinating execution or to throw for unit testing.
Abstract Entry Part to share some common entry functionality.
__construct($description=array())
ComponentEntryDescription constructor.
$key
Definition: croninfo.php:18