ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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, array $dimension_groups=[])
 
 htmlMetadata ()
 
 openGraphMetadata ()
 
 languageTag (string $language_tag)
 
 text ()
 

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
 

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:25

◆ 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,
array  $dimension_groups = [] 
)
Parameters
array<string,Dimension

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

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

◆ dateFormat()

ILIAS\Data\Factory::dateFormat ( )

Definition at line 148 of file Factory.php.

Referenced by 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:39

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

References ILIAS\Data\Factory\$html_metadata_factory, and null.

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

◆ languageTag()

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

Definition at line 221 of file Factory.php.

References ILIAS\Data\LanguageTag\fromString().

221  : LanguageTag
222  {
223  return LanguageTag::fromString($language_tag);
224  }
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: shib_logout.php:66

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

References ILIAS\Data\Factory\$open_graph_metadata_factory, and null.

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
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

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

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

◆ text()

ILIAS\Data\Factory::text ( )

Definition at line 226 of file Factory.php.

References ILIAS\Data\Factory\$text_factory, and null.

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
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

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

◆ 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

Definition at line 38 of file Factory.php.

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