3 declare(strict_types=1);
45 $this->total_votes = (
int) (
$res[
'total'] ?? 0);
47 $this->answer_percentages = array_map(
48 fn (array
$a) => (
float) ($a[
'perc'] ?? 0),
51 $this->answer_totals = array_map(
52 fn (array $a) => (
int) ($a[
'abs'] ?? 0),
62 if ($this->sort_by_votes) {
65 $order = array_keys($order);
67 foreach ($this->answers->getAnswers() as
$id => $answer) {
68 if (!in_array($id, $order)) {
73 foreach ($order as $id) {
77 foreach ($this->answers->getAnswers() as
$id => $answer) {
90 return $this->answers->getAnswer($id);
95 return $this->answer_percentages[
$id] ?? 0;
100 return $this->answer_totals[
$id] ?? 0;
array $answer_percentages
__construct(ilObjPoll $poll, ilPollAnswersHandler $answers)
ilPollAnswersHandler $answers
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getAnswerPercentage(int $id)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...