19 declare(strict_types=1);
39 array $possibleDocuments
51 $clone->evaluation = $clone->evaluation->withContextUser($user);
62 $this->matchingDocumentsByUser[$this->
user->getId()] = [];
64 $this->log->debug(sprintf(
65 'Evaluating document for user "%s" (id: %s) ...',
66 $this->
user->getLogin(),
70 foreach ($this->possibleDocuments as $document) {
72 $this->matchingDocumentsByUser[$this->
user->getId()][] = $document;
76 $this->log->debug(sprintf(
77 '%s matching document(s) found',
78 count($this->matchingDocumentsByUser[$this->
user->getId()])
82 return $this->matchingDocumentsByUser[$this->
user->getId()];
87 return $this->evaluation->evaluate($document);
93 if (count($matchingDocuments) > 0) {
94 return $matchingDocuments[0];
98 'Could not find any terms of service document for the passed user (id: %s|login: %s)',
100 $this->
user->getLogin()
__construct(ilTermsOfServiceDocumentCriteriaEvaluation $evaluation, ilObjUser $user, ilLogger $log, array $possibleDocuments)
array $matchingDocumentsByUser
Interface ilTermsOfServiceSequentialDocumentEvaluation.
Interface ilTermsOfServiceDocumentEvaluation.
Interface ilTermsOfServiceDocumentCriteriaEvaluation.
withContextUser(ilObjUser $user)
Returns an evaluator like this with the passed context user.
Class ilTermsOfServiceNoSignableDocumentFoundException.
Interface ilTermsOfServiceSignableDocument.
ilTermsOfServiceDocumentCriteriaEvaluation $evaluation
evaluateDocument(ilTermsOfServiceSignableDocument $document)
Evaluates the passed document for the context given in the concrete implementation.
document()
Determines a document based on the context of the concrete implementation.