ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilADTIntegerDefinition.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
23 protected ?int $min_value;
24 protected ?int $max_value;
25 protected string $suffix = '';
26
27 // properties
28
29 public function handleNumber(?int $a_value): ?int
30 {
31 if (!is_numeric($a_value)) {
32 $a_value = null;
33 }
34 if ($a_value !== null) {
35 // round?
36 $a_value = (int) $a_value;
37 }
38 return $a_value;
39 }
40
41 public function getMin(): ?int
42 {
43 return $this->min_value;
44 }
45
46 public function setMin(?int $a_value): void
47 {
48 $this->min_value = $this->handleNumber($a_value);
49 }
50
51 public function getMax(): ?int
52 {
53 return $this->max_value;
54 }
55
56 public function setMax(?int $a_value): void
57 {
58 $this->max_value = $this->handleNumber($a_value);
59 }
60
61 public function getSuffix(): string
62 {
63 return $this->suffix;
64 }
65
66 public function setSuffix(?string $a_value): void
67 {
68 $this->suffix = $a_value === null ? '' : trim($a_value);
69 }
70
71 public function isComparableTo(ilADT $a_adt): bool
72 {
73 // has to be number-based
74 return ($a_adt instanceof ilADTInteger);
75 }
76}
ADT definition base class.
isComparableTo(ilADT $a_adt)
Check if given ADT is comparable to self.
ADT base class.
Definition: class.ilADT.php:26