ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilAccessibilitySequentialDocumentEvaluation.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
3
8{
10 protected $evaluation;
11
13 protected $user;
14
16 protected $matchingDocuments = null;
17
19 protected $possibleDocuments = [];
20
22 protected $log;
23
31 public function __construct(
36 ) {
37 $this->evaluation = $evaluation;
38 $this->user = $user;
39 $this->log = $log;
40 $this->possibleDocuments = $possibleDocuments;
41 }
42
46 protected function getMatchingDocuments() : array
47 {
48 if (null === $this->matchingDocuments) {
49 $this->matchingDocuments = [];
50
51 $this->log->debug(sprintf(
52 'Evaluating document for user "%s" (id: %s) ...',
53 $this->user->getLogin(),
54 $this->user->getId()
55 ));
56
57 foreach ($this->possibleDocuments as $document) {
58 if ($this->evaluation->evaluate($document)) {
59 $this->matchingDocuments[] = $document;
60 }
61 }
62
63 $this->log->debug(sprintf(
64 '%s matching document(s) found',
65 count($this->matchingDocuments)
66 ));
67 }
68
70 }
71
76 {
78 if (count($matchingDocuments) > 0) {
79 return $matchingDocuments[0];
80 }
81
83 'Could not find any accessibility control concept document for the passed user (id: %s|login: %s)',
84 $this->user->getId(),
85 $this->user->getLogin()
86 ));
87 }
88
92 public function hasDocument() : bool
93 {
94 return count($this->getMatchingDocuments()) > 0;
95 }
96}
user()
Definition: user.php:4
An exception for terminatinating execution or to throw for unit testing.
Interface ilAccessibilitySequentialDocumentEvaluation.
__construct(ilAccessibilityDocumentCriteriaEvaluation $evaluation, ilObjUser $user, ilLogger $log, array $possibleDocuments)
ilAccessibilityDocumentLogicalAndCriteriaEvaluation constructor.
Component logger with individual log levels by component id.
Interface ilAccessibilityDocumentEvaluation.
Interface ilAccessibilitySignableDocument.