ILIAS  release_8 Revision v8.24
ilADTFloatDefinition Class Reference
+ Inheritance diagram for ilADTFloatDefinition:
+ Collaboration diagram for ilADTFloatDefinition:

Public Member Functions

 handleNumber ($a_value)
 
 getMin ()
 
 setMin (?float $a_value)
 
 getMax ()
 
 setMax (?float $a_value)
 
 getSuffix ()
 
 setSuffix (?string $a_value)
 
 isComparableTo (ilADT $a_adt)
 Check if given ADT is comparable to self. More...
 
 reset ()
 Init property defaults. More...
 
 getDecimals ()
 
 setDecimals (int $a_value)
 
- Public Member Functions inherited from ilADTDefinition
 __construct ()
 
 getType ()
 Get type (from class/instance) More...
 
 reset ()
 Init property defaults. More...
 
 setAllowNull (bool $a_value)
 Toggle null allowed status. More...
 
 isNullAllowed ()
 
 isComparableTo (ilADT $a_adt)
 Check if given ADT is comparable to self. More...
 

Protected Attributes

int $decimals
 
float $min_value
 
float $max_value
 
string $suffix = ''
 
- Protected Attributes inherited from ilADTDefinition
bool $allow_null
 

Detailed Description

Definition at line 5 of file class.ilADTFloatDefinition.php.

Member Function Documentation

◆ getDecimals()

ilADTFloatDefinition::getDecimals ( )

Definition at line 68 of file class.ilADTFloatDefinition.php.

68 : int
69 {
70 return $this->decimals;
71 }

References $decimals.

◆ getMax()

ilADTFloatDefinition::getMax ( )

Definition at line 36 of file class.ilADTFloatDefinition.php.

36 : ?float
37 {
38 return $this->max_value;
39 }

References $max_value.

◆ getMin()

ilADTFloatDefinition::getMin ( )

Definition at line 26 of file class.ilADTFloatDefinition.php.

26 : ?float
27 {
28 return $this->min_value;
29 }

References $min_value.

◆ getSuffix()

ilADTFloatDefinition::getSuffix ( )

Definition at line 46 of file class.ilADTFloatDefinition.php.

46 : string
47 {
48 return $this->suffix;
49 }

References $suffix.

◆ handleNumber()

ilADTFloatDefinition::handleNumber (   $a_value)

Definition at line 14 of file class.ilADTFloatDefinition.php.

14 : ?float
15 {
16 if (!is_numeric($a_value)) {
17 $a_value = null;
18 }
19 if ($a_value !== null) {
20 // round?
21 $a_value = (float) $a_value;
22 }
23 return $a_value;
24 }

Referenced by setMax(), and setMin().

+ Here is the caller graph for this function:

◆ isComparableTo()

ilADTFloatDefinition::isComparableTo ( ilADT  $a_adt)

Check if given ADT is comparable to self.

Parameters
ilADT$a_adt
Returns
bool

Reimplemented from ilADTDefinition.

Definition at line 56 of file class.ilADTFloatDefinition.php.

56 : bool
57 {
58 // has to be number-based
59 return ($a_adt instanceof ilADTFloat);
60 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ reset()

ilADTFloatDefinition::reset ( )

Init property defaults.

Reimplemented from ilADTDefinition.

Definition at line 62 of file class.ilADTFloatDefinition.php.

62 : void
63 {
64 parent::reset();
65 $this->setDecimals(1);
66 }

References setDecimals().

+ Here is the call graph for this function:

◆ setDecimals()

ilADTFloatDefinition::setDecimals ( int  $a_value)

Definition at line 73 of file class.ilADTFloatDefinition.php.

73 : void
74 {
75 // max precision ?!
76 $this->decimals = max(1, abs($a_value));
77 }

Referenced by reset().

+ Here is the caller graph for this function:

◆ setMax()

ilADTFloatDefinition::setMax ( ?float  $a_value)

Definition at line 41 of file class.ilADTFloatDefinition.php.

41 : void
42 {
43 $this->max_value = $this->handleNumber($a_value);
44 }

References handleNumber().

+ Here is the call graph for this function:

◆ setMin()

ilADTFloatDefinition::setMin ( ?float  $a_value)

Definition at line 31 of file class.ilADTFloatDefinition.php.

31 : void
32 {
33 $this->min_value = $this->handleNumber($a_value);
34 }

References handleNumber().

+ Here is the call graph for this function:

◆ setSuffix()

ilADTFloatDefinition::setSuffix ( ?string  $a_value)

Definition at line 51 of file class.ilADTFloatDefinition.php.

51 : void
52 {
53 $this->suffix = $a_value === null ? '' : trim($a_value);
54 }

Field Documentation

◆ $decimals

int ilADTFloatDefinition::$decimals
protected

Definition at line 7 of file class.ilADTFloatDefinition.php.

Referenced by getDecimals().

◆ $max_value

float ilADTFloatDefinition::$max_value
protected

Definition at line 9 of file class.ilADTFloatDefinition.php.

Referenced by getMax().

◆ $min_value

float ilADTFloatDefinition::$min_value
protected

Definition at line 8 of file class.ilADTFloatDefinition.php.

Referenced by getMin().

◆ $suffix

string ilADTFloatDefinition::$suffix = ''
protected

Definition at line 10 of file class.ilADTFloatDefinition.php.

Referenced by getSuffix().


The documentation for this class was generated from the following file: