ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
Factory.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
21 namespace ILIAS\Refinery;
22 
25 use ILIAS\Refinery\Random\Group as RandomGroup;
26 use ilLanguage;
27 
28 class Factory
29 {
30  private \ILIAS\Data\Factory $dataFactory;
32 
33  public function __construct(\ILIAS\Data\Factory $dataFactory, ilLanguage $language)
34  {
35  $this->dataFactory = $dataFactory;
36  $this->language = $language;
37 
38  $this->language->loadLanguageModule('validation');
39  }
40 
45  public function to(): To\Group
46  {
47  return new To\Group($this->dataFactory);
48  }
49 
59  public function kindlyTo(): KindlyTo\Group
60  {
61  return new KindlyTo\Group($this->dataFactory);
62  }
63 
69  public function in(): In\Group
70  {
71  return new In\Group();
72  }
73 
78  public function int(): Integer\Group
79  {
80  return new Integer\Group($this->dataFactory, $this->language);
81  }
82 
86  public function string(): String\Group
87  {
88  return new String\Group($this->dataFactory, $this->language);
89  }
90 
94  public function custom(): Custom\Group
95  {
96  return new Custom\Group($this->dataFactory, $this->language);
97  }
98 
102  public function container(): Container\Group
103  {
104  return new Container\Group($this->dataFactory);
105  }
106 
110  public function password(): Password\Group
111  {
112  return new Password\Group($this->dataFactory, $this->language);
113  }
114 
118  public function logical(): Logical\Group
119  {
120  return new Logical\Group($this->dataFactory, $this->language);
121  }
122 
126  public function null(): Constraint
127  {
128  return new IsNull($this->dataFactory, $this->language);
129  }
130 
134  public function numeric(): Numeric\Group
135  {
136  return new Numeric\Group($this->dataFactory, $this->language);
137  }
138 
142  public function dateTime(): DateTime\Group
143  {
144  return new DateTime\Group();
145  }
146 
150  public function uri(): URI\Group
151  {
152  return new URI\Group();
153  }
154 
159  public function byTrying(array $transformations): ByTrying
160  {
161  return new ByTrying($transformations, $this->dataFactory);
162  }
163 
164  public function random(): RandomGroup
165  {
166  return new RandomGroup();
167  }
168 
169  public function identity(): Transformation
170  {
171  return new IdentityTransformation();
172  }
173 
174  public function always($value): Transformation
175  {
176  return new ConstantTransformation($value);
177  }
178 }
custom()
Contains constraints and transformations for custom functions.
Definition: Factory.php:94
in()
Creates a factory object to create a transformation object, that can be used to execute other transfo...
Definition: Factory.php:69
null()
Contains constraints for null types.
Definition: Factory.php:126
byTrying(array $transformations)
Accepts Transformations and uses first successful one.
Definition: Factory.php:159
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Group.php:21
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: ByTrying.php:21
__construct(\ILIAS\Data\Factory $dataFactory, ilLanguage $language)
Definition: Factory.php:33
logical()
Contains constraints for logical compositions with other constraints.
Definition: Factory.php:118
Class ChatMainBarProvider .
A constraint encodes some resrtictions on values.
Definition: Constraint.php:31
ilLanguage $language
Definition: Factory.php:31
A password is used as part of credentials for authentication.
Definition: Password.php:16
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Group.php:21
numeric()
Contains constraints for numeric data types.
Definition: Factory.php:134
container()
Contains constraints for container types (e.g.
Definition: Factory.php:102
password()
Contains constraints for password strings.
Definition: Factory.php:110
The scope of this class is split ilias-conform URI&#39;s into components.
Definition: URI.php:34
dateTime()
Contains transformations for DateTime.
Definition: Factory.php:142
ILIAS Data Factory $dataFactory
Definition: Factory.php:30
uri()
Contains transformations for Data.
Definition: Factory.php:150
int()
Contains constraints and transformations on numbers.
Definition: Factory.php:78
to()
Combined validations and transformations for primitive data types that establish a baseline for furth...
Definition: Factory.php:45
A transformation is a function from one datatype to another.
kindlyTo()
Combined validations and transformations for primitive data types that establish a baseline for furth...
Definition: Factory.php:59
string()
Contains constraints for string.
Definition: Factory.php:86