ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 21 of file class.ilADTFloatDefinition.php.

Member Function Documentation

◆ getDecimals()

ilADTFloatDefinition::getDecimals ( )

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

84 : int
85 {
86 return $this->decimals;
87 }

References $decimals.

◆ getMax()

ilADTFloatDefinition::getMax ( )

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

52 : ?float
53 {
54 return $this->max_value;
55 }

References $max_value.

◆ getMin()

ilADTFloatDefinition::getMin ( )

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

42 : ?float
43 {
44 return $this->min_value;
45 }

References $min_value.

◆ getSuffix()

ilADTFloatDefinition::getSuffix ( )

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

62 : string
63 {
64 return $this->suffix;
65 }

References $suffix.

◆ handleNumber()

ilADTFloatDefinition::handleNumber (   $a_value)

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

30 : ?float
31 {
32 if (!is_numeric($a_value)) {
33 $a_value = null;
34 }
35 if ($a_value !== null) {
36 // round?
37 $a_value = (float) $a_value;
38 }
39 return $a_value;
40 }

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 72 of file class.ilADTFloatDefinition.php.

72 : bool
73 {
74 // has to be number-based
75 return ($a_adt instanceof ilADTFloat);
76 }

◆ reset()

ilADTFloatDefinition::reset ( )

Init property defaults.

Reimplemented from ilADTDefinition.

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

78 : void
79 {
80 parent::reset();
81 $this->setDecimals(1);
82 }

References setDecimals().

+ Here is the call graph for this function:

◆ setDecimals()

ilADTFloatDefinition::setDecimals ( int  $a_value)

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

89 : void
90 {
91 // max precision ?!
92 $this->decimals = max(1, abs($a_value));
93 }

Referenced by reset().

+ Here is the caller graph for this function:

◆ setMax()

ilADTFloatDefinition::setMax ( ?float  $a_value)

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

57 : void
58 {
59 $this->max_value = $this->handleNumber($a_value);
60 }

References handleNumber().

+ Here is the call graph for this function:

◆ setMin()

ilADTFloatDefinition::setMin ( ?float  $a_value)

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

47 : void
48 {
49 $this->min_value = $this->handleNumber($a_value);
50 }

References handleNumber().

+ Here is the call graph for this function:

◆ setSuffix()

ilADTFloatDefinition::setSuffix ( ?string  $a_value)

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

67 : void
68 {
69 $this->suffix = $a_value === null ? '' : trim($a_value);
70 }

Field Documentation

◆ $decimals

int ilADTFloatDefinition::$decimals
protected

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

Referenced by getDecimals().

◆ $max_value

float ilADTFloatDefinition::$max_value
protected

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

Referenced by getMax().

◆ $min_value

float ilADTFloatDefinition::$min_value
protected

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

Referenced by getMin().

◆ $suffix

string ilADTFloatDefinition::$suffix = ''
protected

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

Referenced by getSuffix().


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