ILIAS  release_8 Revision v8.23
ilTermsOfServiceCriterionTypeFactory Class Reference

Class ilTermsOfServiceCriterionTypeFactory. More...

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

Public Member Functions

 __construct (ilRbacReview $rbacReview, ilObjectDataCache $objectCache, array $countryCodes)
 ilTermsOfServiceCriterionTypeFactory constructor. More...
 
 getTypesByIdentMap ()
 
 findByTypeIdent (string $typeIdent, bool $useFallback=false)
 

Protected Attributes

array $types = []
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilTermsOfServiceCriterionTypeFactory::__construct ( ilRbacReview  $rbacReview,
ilObjectDataCache  $objectCache,
array  $countryCodes 
)

ilTermsOfServiceCriterionTypeFactory constructor.

Parameters
ilRbacReview$rbacReview
ilObjectDataCache$objectCache
string[]$countryCodes

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

37  {
38  $usrLanguageCriterion = new ilTermsOfServiceUserHasLanguageCriterion();
39  $usrGlobalRoleCriterion = new ilTermsOfServiceUserHasGlobalRoleCriterion($rbacReview, $objectCache);
40  $usrCountryCriterion = new ilTermsOfServiceUserHasCountryCriterion($countryCodes);
41 
42  $this->types = [
43  $usrLanguageCriterion->getTypeIdent() => $usrLanguageCriterion,
44  $usrGlobalRoleCriterion->getTypeIdent() => $usrGlobalRoleCriterion,
45  $usrCountryCriterion->getTypeIdent() => $usrCountryCriterion,
46  ];
47  }

Member Function Documentation

◆ findByTypeIdent()

ilTermsOfServiceCriterionTypeFactory::findByTypeIdent ( string  $typeIdent,
bool  $useFallback = false 
)
Parameters
string$typeIdent
bool$useFallback
Returns
ilTermsOfServiceCriterionType
Exceptions
ilTermsOfServiceCriterionTypeNotFoundException

Implements ilTermsOfServiceCriterionTypeFactoryInterface.

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

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

55  {
56  if (isset($this->types[$typeIdent])) {
57  return $this->types[$typeIdent];
58  }
59 
60  if ($useFallback) {
61  return new ilTermsOfServiceNullCriterion();
62  }
63 
65  'Did not find criterion type by ident: %s',
66  var_export($typeIdent, true)
67  ));
68  }
Interface ilTermsOfServiceCriterionType.
Class ilTermsOfServiceNullCriterion.
+ Here is the caller graph for this function:

◆ getTypesByIdentMap()

Field Documentation

◆ $types

array ilTermsOfServiceCriterionTypeFactory::$types = []
protected

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

Referenced by getTypesByIdentMap().


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