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

Class ilTermsOfServiceCriterionTypeFactory. More...

+ Inheritance diagram for ilTermsOfServiceCriterionTypeFactory:
+ Collaboration diagram for ilTermsOfServiceCriterionTypeFactory:

Public Member Functions

 __construct (\ilRbacReview $rbacReview, \ilObjectDataCache $objectCache)
 ilTermsOfServiceCriterionTypeFactory constructor. More...
 
 getTypesByIdentMap ()
 
Returns
[]
More...
 
 findByTypeIdent (string $typeIdent, bool $useFallback=false)
 
Parameters
string$typeIdent
bool$useFallback
Returns
ilTermsOfServiceCriterionType
Exceptions
More...
 

Protected Attributes

 $types = []
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilTermsOfServiceCriterionTypeFactory::__construct ( \ilRbacReview  $rbacReview,
\ilObjectDataCache  $objectCache 
)

ilTermsOfServiceCriterionTypeFactory constructor.

Parameters
\ilRbacReview$rbacReview
\ilObjectDataCache$objectCache

Definition at line 18 of file class.ilTermsOfServiceCriterionTypeFactory.php.

19  {
20  $usrLanguageCriterion = new ilTermsOfServiceUserHasLanguageCriterion();
21  $usrGlobalRoleCriterion = new ilTermsOfServiceUserHasGlobalRoleCriterion($rbacReview, $objectCache);
22 
23  $this->types = [
24  $usrLanguageCriterion->getTypeIdent() => $usrLanguageCriterion,
25  $usrGlobalRoleCriterion->getTypeIdent() => $usrGlobalRoleCriterion,
26  ];
27  }

Member Function Documentation

◆ findByTypeIdent()

ilTermsOfServiceCriterionTypeFactory::findByTypeIdent ( string  $typeIdent,
bool  $useFallback = false 
)

Parameters
string$typeIdent
bool$useFallback
Returns
ilTermsOfServiceCriterionType
Exceptions

Implements ilTermsOfServiceCriterionTypeFactoryInterface.

Definition at line 40 of file class.ilTermsOfServiceCriterionTypeFactory.php.

Referenced by ilTermsOfServiceCriterionTypeFactoryTest\testCriterionIsReturnedIfRequestedByTypeIdent(), ilTermsOfServiceCriterionTypeFactoryTest\testExceptionIsRaisedIfUnsupportedCriterionIsRequested(), and ilTermsOfServiceCriterionTypeFactoryTest\testNullCriterionIsReturnedAsFallbackIfUnsupportedCriterionIsRequested().

41  {
42  if (isset($this->types[$typeIdent])) {
43  return $this->types[$typeIdent];
44  }
45 
46  if ($useFallback) {
47  return new \ilTermsOfServiceNullCriterion();
48  }
49 
50  throw new \ilTermsOfServiceCriterionTypeNotFoundException(sprintf(
51  "Did not find criterion type by ident: %s",
52  var_export($typeIdent, 1)
53  ));
54  }
Interface ilTermsOfServiceCriterionType.
+ Here is the caller graph for this function:

◆ getTypesByIdentMap()

Field Documentation

◆ $types

ilTermsOfServiceCriterionTypeFactory::$types = []
protected

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

Referenced by getTypesByIdentMap().


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