ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Data\Factory Class Reference

Builds data types. More...

+ Inheritance diagram for ILIAS\Data\Factory:
+ Collaboration diagram for ILIAS\Data\Factory:

Public Member Functions

 ok ($value)
 Get an ok result. More...
 
 error ($e)
 Get an error result. More...
 
 color ($value)
 Color is a data type representing a color in HTML. More...
 
 uri (string $uri_string)
 Object representing an uri valid according to RFC 3986 with restrictions imposed on valid characters and obliagtory parts. More...
 
 dataSize ($size, ?string $unit=null)
 Represents the size of some data. More...
 
 password (string $pass)
 
 clientId (string $clientId)
 
 refId (int $ref_id)
 
 objId (int $obj_id)
 
 alphanumeric ($value)
 
 positiveInteger (int $value)
 
 dateFormat ()
 
 range (int $start, int $length)
 
 order (string $subject, string $direction)
 
 version (string $version)
 
 link (string $label, URI $url)
 
 clock ()
 
 dimension ()
 
 dataset (array $dimensions, array $dimension_groups=[])
 
 htmlMetadata ()
 
 openGraphMetadata ()
 
 languageTag (string $language_tag)
 
 text ()
 
 description ()
 

Private Attributes

Color Factory $colorfactory = null
 
Dimension Factory $dimensionfactory = null
 
Meta Html Factory $html_metadata_factory = null
 
Meta Html OpenGraph Factory $open_graph_metadata_factory = null
 
Text Factory $text_factory = null
 
Description Factory $description_factory = null
 

Detailed Description

Member Function Documentation

◆ alphanumeric()

ILIAS\Data\Factory::alphanumeric (   $value)
Parameters
mixed$value

Definition at line 138 of file Factory.php.

138 : Alphanumeric
139 {
140 return new Alphanumeric($value);
141 }

◆ clientId()

ILIAS\Data\Factory::clientId ( string  $clientId)

Definition at line 120 of file Factory.php.

120 : ClientId
121 {
122 return new ClientId($clientId);
123 }
$clientId
Definition: ltiregend.php:26

References $clientId.

◆ clock()

ILIAS\Data\Factory::clock ( )

Definition at line 181 of file Factory.php.

181 : ClockFactory
182 {
183 return new ClockFactoryImpl();
184 }

◆ color()

ILIAS\Data\Factory::color (   $value)

Color is a data type representing a color in HTML.

Construct a color with a hex-value or list of RGB-values.

Parameters
string | int[]$value

Definition at line 72 of file Factory.php.

72 : Color
73 {
74 if (!$this->colorfactory) {
75 $this->colorfactory = new Color\Factory();
76 }
77 return $this->colorfactory->build($value);
78 }
Color expresses a certain color by giving the mixing ratio in the RGB color space.
Definition: Color.php:30

◆ dataset()

ILIAS\Data\Factory::dataset ( array  $dimensions,
array  $dimension_groups = [] 
)
Parameters
array<string,Dimension

Dimension> $dimensions Dimensions with their names as keys

Parameters
array<string,Dimension

DimensionGroup> $dimension_groups

Definition at line 198 of file Factory.php.

198 : Chart\Dataset
199 {
200 return new Chart\Dataset($dimensions, $dimension_groups);
201 }

◆ dataSize()

ILIAS\Data\Factory::dataSize (   $size,
?string  $unit = null 
)

Represents the size of some data.

Parameters
string | int$sizestring might be a string like "126 MB"
Exceptions

InvalidArgumentException if first argument is int and second is not a valid unit.

Exceptions

InvalidArgumentException if string size can't be interpreted

Definition at line 97 of file Factory.php.

97 : DataSize
98 {
99 if (is_string($size)) {
100 $match = [];
101 if (!preg_match("/(\d+)\s*([a-zA-Z]+)/", $size, $match)) {
102 throw new \InvalidArgumentException("'$size' can't be interpreted as data size.");
103 }
104 return $this->dataSize((int) $match[1], $match[2]);
105 }
106 if (is_int($size) && (is_null($unit) || !array_key_exists($unit, DataSize::$abbreviations))) {
107 throw new \InvalidArgumentException(
108 "Expected second argument to be a unit for data, '$unit' is unknown."
109 );
110 }
111 $unit_size = DataSize::$abbreviations[$unit];
112 return new DataSize($size * $unit_size, $unit_size);
113 }
static array $abbreviations
Definition: DataSize.php:52
dataSize($size, ?string $unit=null)
Represents the size of some data.
Definition: Factory.php:97

References ILIAS\Data\DataSize\$abbreviations, and ILIAS\Data\Factory\dataSize().

Referenced by ILIAS\Data\Factory\dataSize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dateFormat()

ILIAS\Data\Factory::dateFormat ( )

Definition at line 148 of file Factory.php.

148 : DateFormat\Factory
149 {
150 $builder = new DateFormat\FormatBuilder();
151 return new DateFormat\Factory($builder);
152 }

◆ description()

ILIAS\Data\Factory::description ( )

Definition at line 241 of file Factory.php.

241 : Description\Factory
242 {
243 if ($this->description_factory === null) {
244 $this->description_factory = new Description\Factory();
245 }
247 }
Description Factory $description_factory
Definition: Factory.php:43

References ILIAS\Data\Factory\$description_factory.

◆ dimension()

ILIAS\Data\Factory::dimension ( )

Definition at line 186 of file Factory.php.

186 : Dimension\Factory
187 {
188 if (!$this->dimensionfactory) {
189 $this->dimensionfactory = new Dimension\Factory();
190 }
192 }
Dimension Factory $dimensionfactory
Definition: Factory.php:39

References ILIAS\Data\Factory\$dimensionfactory.

◆ error()

ILIAS\Data\Factory::error (   $e)

Get an error result.

Parameters
string | \Exception$e
Returns
Result

Definition at line 61 of file Factory.php.

References Vendor\Package\$e.

◆ htmlMetadata()

ILIAS\Data\Factory::htmlMetadata ( )

Definition at line 203 of file Factory.php.

203 : Meta\Html\Factory
204 {
205 if (null === $this->html_metadata_factory) {
206 $this->html_metadata_factory = new Meta\Html\Factory();
207 }
208
210 }
Meta Html Factory $html_metadata_factory
Definition: Factory.php:40

References ILIAS\Data\Factory\$html_metadata_factory.

◆ languageTag()

ILIAS\Data\Factory::languageTag ( string  $language_tag)

Definition at line 221 of file Factory.php.

221 : LanguageTag
222 {
223 return LanguageTag::fromString($language_tag);
224 }
static fromString(string $string)
Definition: LanguageTag.php:48

References ILIAS\Data\LanguageTag\fromString().

+ Here is the call graph for this function:

◆ link()

ILIAS\Data\Factory::link ( string  $label,
URI  $url 
)

Definition at line 176 of file Factory.php.

176 : Link
177 {
178 return new Link($label, $url);
179 }
$url
Definition: shib_logout.php:68

References $url.

◆ objId()

ILIAS\Data\Factory::objId ( int  $obj_id)

Definition at line 130 of file Factory.php.

130 : ObjectId
131 {
132 return new ObjectId($obj_id);
133 }

◆ ok()

ILIAS\Data\Factory::ok (   $value)

Get an ok result.

Parameters
mixed$value

Definition at line 50 of file Factory.php.

50 : Result
51 {
52 return new Result\Ok($value);
53 }

◆ openGraphMetadata()

ILIAS\Data\Factory::openGraphMetadata ( )

Definition at line 212 of file Factory.php.

212 : Meta\Html\OpenGraph\Factory
213 {
214 if (null === $this->open_graph_metadata_factory) {
215 $this->open_graph_metadata_factory = new Meta\Html\OpenGraph\Factory();
216 }
217
219 }
Meta Html OpenGraph Factory $open_graph_metadata_factory
Definition: Factory.php:41

References ILIAS\Data\Factory\$open_graph_metadata_factory.

◆ order()

ILIAS\Data\Factory::order ( string  $subject,
string  $direction 
)
Parameters
string$directionOrder::ASC|Order::DESC

Definition at line 162 of file Factory.php.

162 : Order
163 {
164 return new Order($subject, $direction);
165 }

◆ password()

ILIAS\Data\Factory::password ( string  $pass)

Definition at line 115 of file Factory.php.

115 : Password
116 {
117 return new Password($pass);
118 }

References ILIAS\User\Settings\Password.

◆ positiveInteger()

ILIAS\Data\Factory::positiveInteger ( int  $value)

Definition at line 143 of file Factory.php.

143 : PositiveInteger
144 {
145 return new PositiveInteger($value);
146 }

◆ range()

ILIAS\Data\Factory::range ( int  $start,
int  $length 
)

Definition at line 154 of file Factory.php.

154 : Range
155 {
156 return new Range($start, $length);
157 }

◆ refId()

ILIAS\Data\Factory::refId ( int  $ref_id)

Definition at line 125 of file Factory.php.

125 : ReferenceId
126 {
127 return new ReferenceId($ref_id);
128 }
$ref_id
Definition: ltiauth.php:66

References $ref_id.

◆ text()

ILIAS\Data\Factory::text ( )

Definition at line 226 of file Factory.php.

226 : Text\Factory
227 {
228 if ($this->text_factory === null) {
229 $md_format = new \ILIAS\Refinery\String\MarkdownFormattingToHTML();
230 $this->text_factory = new \ILIAS\Data\Text\Factory(
231 new Text\MarkdownFactory(
232 new Text\Shape\Markdown($md_format),
233 new Text\Shape\SimpleDocumentMarkdown($md_format),
234 new Text\Shape\WordOnlyMarkdown($md_format)
235 )
236 );
237 }
238 return $this->text_factory;
239 }
Text Factory $text_factory
Definition: Factory.php:42

References ILIAS\Data\Factory\$text_factory.

◆ uri()

ILIAS\Data\Factory::uri ( string  $uri_string)

Object representing an uri valid according to RFC 3986 with restrictions imposed on valid characters and obliagtory parts.

Definition at line 85 of file Factory.php.

85 : URI
86 {
87 return new URI($uri_string);
88 }
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:35

◆ version()

ILIAS\Data\Factory::version ( string  $version)
Parameters
string$versionin the form \d+([.]\d+([.]\d+)?)?
Exceptions

InvalidArgumentException if version string does not match \d+([.]\d+([.]\d+)?)?

Definition at line 171 of file Factory.php.

171 : Version
172 {
173 return new Version($version);
174 }
$version
Definition: plugin.php:24

References $version.

Field Documentation

◆ $colorfactory

Color Factory ILIAS\Data\Factory::$colorfactory = null
private

Definition at line 38 of file Factory.php.

◆ $description_factory

Description Factory ILIAS\Data\Factory::$description_factory = null
private

Definition at line 43 of file Factory.php.

Referenced by ILIAS\Data\Factory\description().

◆ $dimensionfactory

Dimension Factory ILIAS\Data\Factory::$dimensionfactory = null
private

Definition at line 39 of file Factory.php.

Referenced by ILIAS\Data\Factory\dimension().

◆ $html_metadata_factory

Meta Html Factory ILIAS\Data\Factory::$html_metadata_factory = null
private

Definition at line 40 of file Factory.php.

Referenced by ILIAS\Data\Factory\htmlMetadata().

◆ $open_graph_metadata_factory

Meta Html OpenGraph Factory ILIAS\Data\Factory::$open_graph_metadata_factory = null
private

Definition at line 41 of file Factory.php.

Referenced by ILIAS\Data\Factory\openGraphMetadata().

◆ $text_factory

Text Factory ILIAS\Data\Factory::$text_factory = null
private

Definition at line 42 of file Factory.php.

Referenced by ILIAS\Data\Factory\text().


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