ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables 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)
 

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

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

◆ dataset()

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

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

Definition at line 80 of file Factory.php.

References ILIAS\Data\DataSize\$abbreviations.

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

◆ dateFormat()

ILIAS\Data\Factory::dateFormat ( )

Definition at line 131 of file Factory.php.

Referenced by ilIndividualAssessmentUserGradingTest\testToFormInput(), ilStudyProgrammeDeadlineSettings\toFormInput(), and ilStudyProgrammeValidityOfAchievedQualificationSettings\toFormInput().

131  : DateFormat\Factory
132  {
133  $builder = new DateFormat\FormatBuilder();
134  return new DateFormat\Factory($builder);
135  }
+ Here is the caller graph for this function:

◆ dimension()

ILIAS\Data\Factory::dimension ( )

Definition at line 169 of file Factory.php.

References ILIAS\Data\Factory\$dimensionfactory.

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

◆ error()

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

Get an error result.

Parameters
string | \Exception$e
Returns
Result

Definition at line 44 of file Factory.php.

References Vendor\Package\$e.

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

◆ 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

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

◆ password()

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

Definition at line 98 of file Factory.php.

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

98  : Password
99  {
100  return new Password($pass);
101  }
+ 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

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

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

68  : URI
69  {
70  return new URI($uri_string);
71  }
+ Here is the caller graph for this function:

◆ version()

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

Definition at line 154 of file Factory.php.

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

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: