ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 parent::__construct();
31 }
32
37 public function withDescription($description = array()){
38 $clone = clone $this;
39 $clone->setDescription($description);
40 return $clone;
41 }
42
46 protected function setDescription($descriptionElements)
47 {
48 if(!$descriptionElements){
49 return;
50 }
51 $this->assert()->isArray($descriptionElements);
52 foreach($descriptionElements as $category => $element){
53 $this->assert()->isIndex($category, $this->description);
54
55 if(is_array($this->description[$category])){
56 if($element && $element != "") {
57 $this->assert()->isArray($element);
58 foreach ($element as $key => $part) {
59 $this->assert()->isString($part);
60 $this->description[$category][$key] = $part;
61 }
62 }
63 }else{
64 $this->assert()->isString($element);
65 $this->description[$category] = $element;
66 }
67
68 }
69 }
70
74 public function getProperty($key){
75 $this->assert()->isIndex($key, $this->description);
76
77 return $this->description[$key];
78 }
79
83 public function getDescription(){
84 return $this->description;
85 }
86
90 public function jsonSerialize() {
91 return $this->getDescription();
92 }
93}
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.