ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilTermsOfServiceCriterionConfig.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
9 {
14  public function __construct($data = [])
15  {
16  if (is_array($data)) {
17  parent::__construct($data);
18  } else {
19  parent::__construct([]);
20 
21  if (is_string($data)) {
22  $this->fromJson($data);
23  }
24  }
25  }
26 
30  public function toJson() : string
31  {
32  $json = json_encode($this);
33 
34  return $json;
35  }
36 
40  public function fromJson(string $json)
41  {
42  $data = json_decode($json, true);
43 
44  $this->exchangeArray($data);
45  }
46 
50  public function jsonSerialize()
51  {
52  return $this->getArrayCopy();
53  }
54 }
__construct($data=[])
ilTermsOfServiceCriterionConfig constructor.
Class ilTermsOfServiceCriterionConfig.
Interface ilTermsOfServiceJsonSerializable.
$data
Definition: bench.php:6