ILIAS  release_8 Revision v8.24
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)
 

Private Attributes

Color Factory $colorfactory = null
 cache for color factory. More...
 
Dimension Factory $dimensionfactory = null
 

Detailed Description

Member Function Documentation

◆ alphanumeric()

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

Definition at line 121 of file Factory.php.

121 : Alphanumeric
122 {
123 return new Alphanumeric($value);
124 }

◆ clientId()

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

Definition at line 103 of file Factory.php.

103 : ClientId
104 {
105 return new ClientId($clientId);
106 }
$clientId
Definition: ltiregend.php:27

References $clientId.

◆ clock()

ILIAS\Data\Factory::clock ( )

Definition at line 164 of file Factory.php.

164 : ClockFactory
165 {
166 return new ClockFactoryImpl();
167 }

◆ 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 55 of file Factory.php.

55 : Color
56 {
57 if (!$this->colorfactory) {
58 $this->colorfactory = new Color\Factory();
59 }
60 return $this->colorfactory->build($value);
61 }
Color expresses a certain color by giving the mixing ratio in the RGB color space.
Definition: Color.php:16

◆ dataset()

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

Dimension> $dimensions Dimensions with their names as keys

Definition at line 180 of file Factory.php.

180 : Chart\Dataset
181 {
182 return new Chart\Dataset($dimensions);
183 }

◆ 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 80 of file Factory.php.

80 : DataSize
81 {
82 if (is_string($size)) {
83 $match = [];
84 if (!preg_match("/(\d+)\s*([a-zA-Z]+)/", $size, $match)) {
85 throw new \InvalidArgumentException("'$size' can't be interpreted as data size.");
86 }
87 return $this->dataSize((int) $match[1], $match[2]);
88 }
89 if (is_int($size) && (is_null($unit) || !array_key_exists($unit, DataSize::$abbreviations))) {
90 throw new \InvalidArgumentException(
91 "Expected second argument to be a unit for data, '$unit' is unknown."
92 );
93 }
94 $unit_size = DataSize::$abbreviations[$unit];
95 return new DataSize($size * $unit_size, $unit_size);
96 }
static array $abbreviations
Definition: DataSize.php:53
dataSize($size, string $unit=null)
Represents the size of some data.
Definition: Factory.php:80

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 131 of file Factory.php.

131 : DateFormat\Factory
132 {
133 $builder = new DateFormat\FormatBuilder();
134 return new DateFormat\Factory($builder);
135 }

Referenced by ilIndividualAssessmentUserGradingTest\testToFormInput().

+ Here is the caller graph for this function:

◆ dimension()

ILIAS\Data\Factory::dimension ( )

Definition at line 169 of file Factory.php.

169 : Dimension\Factory
170 {
171 if (!$this->dimensionfactory) {
172 $this->dimensionfactory = new Dimension\Factory();
173 }
175 }
Dimension Factory $dimensionfactory
Definition: Factory.php:26

References ILIAS\Data\Factory\$dimensionfactory.

◆ error()

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

Get an error result.

Parameters
string | \Exception$e
Returns
Result

Definition at line 44 of file Factory.php.

44 : Result
45 {
46 return new Result\Error($e);
47 }

References Vendor\Package\$e.

◆ link()

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

Definition at line 159 of file Factory.php.

159 : Link
160 {
161 return new Link($label, $url);
162 }
$url

References $url.

◆ objId()

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

Definition at line 113 of file Factory.php.

113 : ObjectId
114 {
115 return new ObjectId($obj_id);
116 }

◆ ok()

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

Get an ok result.

Parameters
mixed$value

Definition at line 33 of file Factory.php.

33 : Result
34 {
35 return new Result\Ok($value);
36 }

◆ order()

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

Definition at line 145 of file Factory.php.

145 : Order
146 {
147 return new Order($subject, $direction);
148 }

Referenced by ILIAS\UI\Implementation\Component\Table\Data\getOrder().

+ Here is the caller graph for this function:

◆ password()

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

Definition at line 98 of file Factory.php.

98 : Password
99 {
100 return new Password($pass);
101 }

Referenced by PasswordContraintsTest\constraintsProvider(), and ILIAS\UI\examples\Input\Field\Password\with_contraints().

+ Here is the caller graph for this function:

◆ positiveInteger()

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

Definition at line 126 of file Factory.php.

126 : PositiveInteger
127 {
128 return new PositiveInteger($value);
129 }

◆ range()

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

Definition at line 137 of file Factory.php.

137 : Range
138 {
139 return new Range($start, $length);
140 }

◆ refId()

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

Definition at line 108 of file Factory.php.

108 : ReferenceId
109 {
110 return new ReferenceId($ref_id);
111 }
$ref_id
Definition: ltiauth.php:67

References $ref_id.

◆ 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 68 of file Factory.php.

68 : URI
69 {
70 return new URI($uri_string);
71 }
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 154 of file Factory.php.

154 : Version
155 {
156 return new Version($version);
157 }
$version
Definition: plugin.php:24

References $version.

Referenced by ilPluginInfoTest\versionCompliance().

+ Here is the caller graph for this function:

Field Documentation

◆ $colorfactory

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

cache for color factory.

Definition at line 25 of file Factory.php.

◆ $dimensionfactory

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

Definition at line 26 of file Factory.php.

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


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