ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilTermsOfServiceSequentialDocumentEvaluation Class Reference

Interface ilTermsOfServiceSequentialDocumentEvaluation. More...

+ Inheritance diagram for ilTermsOfServiceSequentialDocumentEvaluation:
+ Collaboration diagram for ilTermsOfServiceSequentialDocumentEvaluation:

Public Member Functions

 __construct (\ilTermsOfServiceDocumentCriteriaEvaluation $evaluation, \ilObjUser $user, \ilLogger $log, array $possibleDocuments)
 ilTermsOfServiceDocumentLogicalAndCriteriaEvaluation constructor. More...
 
 document ()
 
Returns
\ilTermsOfServiceSignableDocument
Exceptions

ilTermsOfServiceNoSignableDocumentFoundException More...

 
 hasDocument ()
 
Returns
bool
More...
 
 document ()
 
 hasDocument ()
 

Protected Member Functions

 getMatchingDocuments ()
 

Protected Attributes

 $evaluation
 
 $user
 
 $matchingDocuments = null
 
 $possibleDocuments = []
 
 $log
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilTermsOfServiceSequentialDocumentEvaluation::__construct ( \ilTermsOfServiceDocumentCriteriaEvaluation  $evaluation,
\ilObjUser  $user,
\ilLogger  $log,
array  $possibleDocuments 
)

ilTermsOfServiceDocumentLogicalAndCriteriaEvaluation constructor.

Parameters
\ilTermsOfServiceDocumentCriteriaEvaluation$evaluation
\ilObjUser$user
\ilLogger$log
\ilTermsOfServiceSignableDocument[]$possibleDocuments

Definition at line 32 of file class.ilTermsOfServiceSequentialDocumentEvaluation.php.

References $evaluation, $log, $possibleDocuments, $user, and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ document()

ilTermsOfServiceSequentialDocumentEvaluation::document ( )

Returns
\ilTermsOfServiceSignableDocument
Exceptions

ilTermsOfServiceNoSignableDocumentFoundException

Implements ilTermsOfServiceDocumentEvaluation.

Definition at line 76 of file class.ilTermsOfServiceSequentialDocumentEvaluation.php.

77 {
79 if (count($matchingDocuments) > 0) {
80 return $matchingDocuments[0];
81 }
82
83 throw new \ilTermsOfServiceNoSignableDocumentFoundException(sprintf(
84 'Could not find any terms of service document for the passed user (id: %s|login: %s)',
85 $this->user->getId(),
86 $this->user->getLogin()
87 ));
88 }
Interface ilTermsOfServiceSignableDocument.

References $matchingDocuments, getMatchingDocuments(), and user().

+ Here is the call graph for this function:

◆ getMatchingDocuments()

ilTermsOfServiceSequentialDocumentEvaluation::getMatchingDocuments ( )
protected
Returns
\ilTermsOfServiceSignableDocument[]

Definition at line 47 of file class.ilTermsOfServiceSequentialDocumentEvaluation.php.

47 : 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 }

References $matchingDocuments, and user().

Referenced by document(), and hasDocument().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasDocument()

ilTermsOfServiceSequentialDocumentEvaluation::hasDocument ( )

Returns
bool

Implements ilTermsOfServiceDocumentEvaluation.

Definition at line 93 of file class.ilTermsOfServiceSequentialDocumentEvaluation.php.

93 : bool
94 {
95 return count($this->getMatchingDocuments()) > 0;
96 }

References getMatchingDocuments().

+ Here is the call graph for this function:

Field Documentation

◆ $evaluation

ilTermsOfServiceSequentialDocumentEvaluation::$evaluation
protected

Definition at line 11 of file class.ilTermsOfServiceSequentialDocumentEvaluation.php.

Referenced by __construct().

◆ $log

ilTermsOfServiceSequentialDocumentEvaluation::$log
protected

Definition at line 23 of file class.ilTermsOfServiceSequentialDocumentEvaluation.php.

Referenced by __construct().

◆ $matchingDocuments

ilTermsOfServiceSequentialDocumentEvaluation::$matchingDocuments = null
protected

◆ $possibleDocuments

ilTermsOfServiceSequentialDocumentEvaluation::$possibleDocuments = []
protected

Definition at line 20 of file class.ilTermsOfServiceSequentialDocumentEvaluation.php.

Referenced by __construct().

◆ $user

ilTermsOfServiceSequentialDocumentEvaluation::$user
protected

Definition at line 14 of file class.ilTermsOfServiceSequentialDocumentEvaluation.php.

Referenced by __construct().


The documentation for this class was generated from the following file: