ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilAccessibilitySequentialDocumentEvaluation.php
Go to the documentation of this file.
1<?php
2
23{
25 protected ilObjUser $user;
27 protected ?array $matchingDocuments = null;
29 protected ?array $possibleDocuments = [];
30 protected ilLogger $log;
31
32 public function __construct(
37 ) {
38 $this->evaluation = $evaluation;
39 $this->user = $user;
40 $this->log = $log;
41 $this->possibleDocuments = $possibleDocuments;
42 }
43
47 protected function getMatchingDocuments(): array
48 {
49 if (null === $this->matchingDocuments) {
50 $this->matchingDocuments = [];
51
52 $this->log->debug(sprintf(
53 'Evaluating document for user "%s" (id: %s) ...',
54 $this->user->getLogin(),
55 $this->user->getId()
56 ));
57
58 foreach ($this->possibleDocuments as $document) {
59 if ($this->evaluation->evaluate($document)) {
60 $this->matchingDocuments[] = $document;
61 }
62 }
63
64 $this->log->debug(sprintf(
65 '%s matching document(s) found',
66 count($this->matchingDocuments)
67 ));
68 }
69
71 }
72
74 {
76 if (count($matchingDocuments) > 0) {
77 return $matchingDocuments[0];
78 }
79
81 'Could not find any accessibility control concept document for the passed user (id: %s|login: %s)',
82 $this->user->getId(),
83 $this->user->getLogin()
84 ));
85 }
86
87 public function hasDocument(): bool
88 {
89 return count($this->getMatchingDocuments()) > 0;
90 }
91}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(ilAccessibilityDocumentCriteriaEvaluation $evaluation, ilObjUser $user, ilLogger $log, array $possibleDocuments)
Component logger with individual log levels by component id.
User class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...