ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilADTBoolean.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21class ilADTBoolean extends ilADT
22{
23 protected ?bool $value;
24
25 // definition
26
27 protected function isValidDefinition(ilADTDefinition $a_def): bool
28 {
29 return ($a_def instanceof ilADTBooleanDefinition);
30 }
31
32 public function reset(): void
33 {
34 parent::reset();
35 $this->value = null;
36 }
37
38 // properties
39
40 public function setStatus(?bool $a_value = null): void
41 {
42 $this->value = $a_value;
43 }
44
45 public function getStatus(): ?bool
46 {
47 return $this->value;
48 }
49
50 // comparison
51
52 public function equals(ilADT $a_adt): ?bool
53 {
54 if ($this->getDefinition()->isComparableTo($a_adt)) {
55 return ($this->getStatus() === $a_adt->getStatus());
56 }
57 return null;
58 }
59
60 public function isLarger(ilADT $a_adt): ?bool
61 {
62 return null;
63 }
64
65 public function isSmaller(ilADT $a_adt): ?bool
66 {
67 return null;
68 }
69
70 // null
71
72 public function isNull(): bool
73 {
74 return $this->getStatus() === null;
75 }
76
77 public function isValid(): bool
78 {
79 return true;
80 }
81
82 // check
83
84 public function getCheckSum(): ?string
85 {
86 if (!$this->isNull()) {
87 return (string) $this->getStatus();
88 }
89 return null;
90 }
91
92 // stdClass
93
94 public function exportStdClass(): ?stdClass
95 {
96 if (!$this->isNull()) {
97 $obj = new stdClass();
98 $obj->value = $this->getStatus();
99 return $obj;
100 }
101 return null;
102 }
103
104 public function importStdClass(?stdClass $a_std): void
105 {
106 if (is_object($a_std)) {
107 $this->setStatus((bool) $a_std->value);
108 }
109 }
110}
Class ilADTBooleanDefinition.
setStatus(?bool $a_value=null)
equals(ilADT $a_adt)
Check if given ADT equals self.
reset()
Init property defaults.
importStdClass(?stdClass $a_std)
Import value from stdClass.
isSmaller(ilADT $a_adt)
Check if given ADT is smaller than self.
isValidDefinition(ilADTDefinition $a_def)
Check if definition is valid for ADT.
isNull()
Is currently null.
exportStdClass()
Export value as stdClass.
isLarger(ilADT $a_adt)
Check if given ADT is larger than self.
getCheckSum()
Get unique checksum.
ADT definition base class.
ADT base class.
Definition: class.ilADT.php:26
getDefinition()
Get definition.