ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ComponentEntryRules.php
Go to the documentation of this file.
1 <?php
2 
4 
13 {
17  protected $rules = array(
18  "usage"=>array(),
19  "composition"=>array(),
20  "interaction"=>array(),
21  "wording"=>array(),
22  "ordering"=>array(),
23  "style"=>array(),
24  "responsiveness"=>array(),
25  "accessibility"=>array()
26  );
27 
32  public function __construct($rules = array())
33  {
34  parent::__construct();
35  $this->setRules($rules);
36  }
37 
42  public function withRules($rules = array())
43  {
44  $clone = clone $this;
45  $clone->setRules($rules);
46  return $clone;
47  }
48 
53  protected function setRules($rules)
54  {
55  if (!$rules) {
56  return;
57  }
58  $this->assert()->isArray($rules);
59  foreach ($rules as $rule_category => $category_rules) {
60  $this->assert()->isIndex($rule_category, $this->rules);
61  if ($category_rules && $category_rules != "") {
62  $this->assert()->isArray($category_rules);
63  foreach ($category_rules as $rule_id => $rule) {
64  $this->assert()->isString($rule);
65  $this->rules[$rule_category][$rule_id] = $rule;
66  }
67  }
68  }
69  }
70 
74  public function getRules()
75  {
76  return $this->rules;
77  }
78 
82  public function jsonSerialize()
83  {
84  return $this->getRules();
85  }
86 }
Abstract Entry Part to share some common entry functionality.
__construct($rules=array())
ComponentEntryDescription constructor.
$rule
Definition: showstats.php:43
Create styles array
The data for the language used.