ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Factory.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 2017 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
3
4namespace ILIAS\Data;
5
15{
20
27 public function ok($value)
28 {
29 return new Result\Ok($value);
30 }
31
38 public function error($e)
39 {
40 return new Result\Error($e);
41 }
42
50 public function color($value)
51 {
52 if (!$this->colorfactory) {
53 $this->colorfactory = new Color\Factory();
54 }
55 return $this->colorfactory->build($value);
56 }
57
62 public function clientId($clientId)
63 {
64 return new ClientId($clientId);
65 }
66}
An exception for terminatinating execution or to throw for unit testing.
Builds a Color from either hex- or rgb values.
Definition: Factory.php:14
Builds data types.
Definition: Factory.php:15
clientId($clientId)
Definition: Factory.php:62
color($value)
Color is a data type representing a color in HTML.
Definition: Factory.php:50
$colorfactory
cache for color factory.
Definition: Factory.php:19
ok($value)
Get an ok result.
Definition: Factory.php:27
error($e)
Get an error result.
Definition: Factory.php:38
A result encapsulates a value or an error and simplifies the handling of those.
Definition: Error.php:14
A result encapsulates a value or an error and simplifies the handling of those.
Definition: Ok.php:14