ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilTermsOfServiceUserHasLanguageCriterion.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3
9{
13 public function getTypeIdent() : string
14 {
15 return 'usr_language';
16 }
17
21 public function hasUniqueNature() : bool
22 {
23 return true;
24 }
25
30 {
31 $lng = $config['lng'] ?? '';
32
33 if (!is_string($lng) || 2 !== strlen($lng)) {
34 return false;
35 }
36
37 $result = strtolower($lng) === strtolower($user->getLanguage());
38
39 return $result;
40 }
41
46 {
47 return new \ilTermsOfServiceUserHasLanguageCriterionGUI($this, $lng);
48 }
49}
$result
An exception for terminatinating execution or to throw for unit testing.
language handling
Class ilTermsOfServiceCriterionConfig.
hasUniqueNature()
Returns whether or not a criterion is unique by it's nature.Example: "User Language"....
evaluate(\ilObjUser $user, \ilTermsOfServiceCriterionConfig $config)
bool
ui(\ilLanguage $lng)
\ilTermsOfServiceCriterionTypeGUI
getTypeIdent()
Returns a unique id of the criterion type.string
Interface ilTermsOfServiceCriterionTypeGUI.
Interface ilTermsOfServiceCriterionType.
$config
Definition: bootstrap.php:15
$user
Definition: migrateto20.php:57
$lng