ILIAS  release_8 Revision v8.24
class.ilADTBoolean.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
5class ilADTBoolean extends ilADT
6{
7 protected ?bool $value;
8
9 // definition
10
11 protected function isValidDefinition(ilADTDefinition $a_def): bool
12 {
13 return ($a_def instanceof ilADTBooleanDefinition);
14 }
15
16 public function reset(): void
17 {
18 parent::reset();
19 $this->value = null;
20 }
21
22 // properties
23
24 public function setStatus(bool $a_value = null): void
25 {
26 $this->value = $a_value;
27 }
28
29 public function getStatus(): ?bool
30 {
31 return $this->value;
32 }
33
34 // comparison
35
36 public function equals(ilADT $a_adt): ?bool
37 {
38 if ($this->getDefinition()->isComparableTo($a_adt)) {
39 return ($this->getStatus() === $a_adt->getStatus());
40 }
41 return null;
42 }
43
44 public function isLarger(ilADT $a_adt): ?bool
45 {
46 return null;
47 }
48
49 public function isSmaller(ilADT $a_adt): ?bool
50 {
51 return null;
52 }
53
54 // null
55
56 public function isNull(): bool
57 {
58 return $this->getStatus() === null;
59 }
60
61 public function isValid(): bool
62 {
63 return true;
64 }
65
66 // check
67
68 public function getCheckSum(): ?string
69 {
70 if (!$this->isNull()) {
71 return (string) $this->getStatus();
72 }
73 return null;
74 }
75
76 // stdClass
77
78 public function exportStdClass(): ?stdClass
79 {
80 if (!$this->isNull()) {
81 $obj = new stdClass();
82 $obj->value = $this->getStatus();
83 return $obj;
84 }
85 return null;
86 }
87
88 public function importStdClass(?stdClass $a_std): void
89 {
90 if (is_object($a_std)) {
91 $this->setStatus((bool) $a_std->value);
92 }
93 }
94}
Class ilADTBooleanDefinition.
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.
setStatus(bool $a_value=null)
ADT definition base class.
ADT base class.
Definition: class.ilADT.php:12
getDefinition()
Get definition.
Definition: class.ilADT.php:92