3 declare(strict_types=1);
39 public function __construct(
int $maximum,
int $main,
int $required = null,
int $comparison = null)
41 $this->maximum = $maximum;
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;
61 return $this->maximum;
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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getMainValueAsPercent()
Get main value as percent.
getAsPercentage(int $int)
get an integer value as percent value
getRequiredAsPercent()
Get required value as percent.
getSafe(int $int)
Get integer value "1" if a value is negative or "maximum" if value is more than maximum.
getMaximum()
Get maximum value.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...