ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ILIAS\Data\Factory Class Reference

Builds data types. More...

+ 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)
 
 htmlMetadata ()
 
 openGraphMetadata ()
 
 languageTag (string $language_tag)
 

Private Attributes

Color Factory $colorfactory = null
 cache for color factory. More...
 
Dimension Factory $dimensionfactory = null
 
Meta Html Factory $html_metadata_factory = null
 
Meta Html OpenGraph Factory $open_graph_metadata_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:27

◆ 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  }

◆ dataset()

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

Definition at line 197 of file Factory.php.

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

◆ 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

Definition at line 97 of file Factory.php.

References ILIAS\Data\DataSize\$abbreviations.

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  }
dataSize($size, string $unit=null)
Represents the size of some data.
Definition: Factory.php:97
static array $abbreviations
Definition: DataSize.php:52

◆ dateFormat()

ILIAS\Data\Factory::dateFormat ( )

Definition at line 148 of file Factory.php.

Referenced by ILIAS\UI\examples\Table\Data\base(), ilIndividualAssessmentUserGradingTest\testToFormInput(), ilStudyProgrammeDeadlineSettings\toFormInput(), and ilStudyProgrammeValidityOfAchievedQualificationSettings\toFormInput().

148  : DateFormat\Factory
149  {
150  $builder = new DateFormat\FormatBuilder();
151  return new DateFormat\Factory($builder);
152  }
+ Here is the caller graph for this function:

◆ dimension()

ILIAS\Data\Factory::dimension ( )

Definition at line 186 of file Factory.php.

References ILIAS\Data\Factory\$dimensionfactory.

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

◆ 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.

61  : Result
62  {
63  return new Result\Error($e);
64  }

◆ htmlMetadata()

ILIAS\Data\Factory::htmlMetadata ( )

Definition at line 202 of file Factory.php.

References ILIAS\Data\Factory\$html_metadata_factory.

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

◆ languageTag()

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

Definition at line 220 of file Factory.php.

References ILIAS\Data\LanguageTag\fromString().

220  : LanguageTag
221  {
222  return LanguageTag::fromString($language_tag);
223  }
static fromString(string $string)
Definition: LanguageTag.php:48
+ 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: ltiregstart.php:35

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

References ILIAS\Data\Factory\$open_graph_metadata_factory.

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

◆ 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.

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

115  : Password
116  {
117  return new Password($pass);
118  }
+ Here is the caller graph for this function:

◆ 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:67

◆ 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.

Referenced by ILIAS\UI\examples\Table\Action\Multi\base(), ILIAS\UI\examples\Table\Action\Single\base(), and ILIAS\UI\examples\Table\Action\Standard\base().

85  : URI
86  {
87  return new URI($uri_string);
88  }
+ Here is the caller graph for this function:

◆ version()

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

Definition at line 171 of file Factory.php.

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

Field Documentation

◆ $colorfactory

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

cache for color factory.

Definition at line 40 of file Factory.php.

◆ $dimensionfactory

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

Definition at line 41 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 42 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 43 of file Factory.php.

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


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