19 declare(strict_types=1);
42 $this->main = $this->
getSafe($main);
44 if ($required !=
null) {
45 $this->required = $this->
getSafe($required);
47 $this->required = $this->
getSafe($maximum);
49 if ($comparison !=
null) {
50 $this->comparison = $this->
getSafe($comparison);
52 $this->comparison = 0;
69 return $this->
getSafe($this->required);
85 return $this->
getSafe($this->main);
109 return (
int) round(100 / $this->
getMaximum() * $this->
getSafe($int), 0, PHP_ROUND_HALF_UP);
__construct(int $maximum, int $main, ?int $required=null, ?int $comparison=null)
getMainValueAsPercent()
Get main value as percent.
getAsPercentage(int $int)
get an integer value as percent value
getRequiredAsPercent()
Get required value as percent.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getSafe(int $int)
Get integer value "1" if a value is negative or "maximum" if value is more than maximum.