ILIAS  release_8 Revision v8.24
Factory.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
21namespace ILIAS\Refinery;
22
25use ILIAS\Refinery\Random\Group as RandomGroup;
26use ilLanguage;
27
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}
Builds data types.
Definition: Factory.php:21
A password is used as part of credentials for authentication.
Definition: Password.php:17
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:35
ilLanguage $language
Definition: Factory.php:31
__construct(\ILIAS\Data\Factory $dataFactory, ilLanguage $language)
Definition: Factory.php:33
container()
Contains constraints for container types (e.g.
Definition: Factory.php:102
custom()
Contains constraints and transformations for custom functions.
Definition: Factory.php:94
int()
Contains constraints and transformations on numbers.
Definition: Factory.php:78
password()
Contains constraints for password strings.
Definition: Factory.php:110
logical()
Contains constraints for logical compositions with other constraints.
Definition: Factory.php:118
in()
Creates a factory object to create a transformation object, that can be used to execute other transfo...
Definition: Factory.php:69
uri()
Contains transformations for Data\URI.
Definition: Factory.php:150
numeric()
Contains constraints for numeric data types.
Definition: Factory.php:134
byTrying(array $transformations)
Accepts Transformations and uses first successful one.
Definition: Factory.php:159
string()
Contains constraints for string.
Definition: Factory.php:86
kindlyTo()
Combined validations and transformations for primitive data types that establish a baseline for furth...
Definition: Factory.php:59
to()
Combined validations and transformations for primitive data types that establish a baseline for furth...
Definition: Factory.php:45
ILIAS Data Factory $dataFactory
Definition: Factory.php:30
dateTime()
Contains transformations for DateTime.
Definition: Factory.php:142
language handling
A constraint encodes some resrtictions on values.
Definition: Constraint.php:32
A transformation is a function from one datatype to another.
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: 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
Class ChatMainBarProvider \MainMenu\Provider.