ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ILIAS\Refinery Namespace Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

Namespaces

 Container
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
 
 Custom
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
 
 DateTime
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
 
 In
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
 
 Integer
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
 
 KindlyTo
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
 
 Logical
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
 
 Numeric
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
 
 Password
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
 
 Random
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
 
 String
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
 
 To
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
 
 URI
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
 

Data Structures

class  ByTrying
 
class  ConstantTransformation
 
interface  Constraint
 A constraint encodes some resrtictions on values. More...
 
class  ConstraintViolationException
 
class  Factory
 
class  IdentityTransformation
 
class  IsNull
 
class  KeyValueAccess
 
interface  Transformation
 A transformation is a function from one datatype to another. More...
 

Functions

 applyTo (Result $result)
 
 __invoke ($from)
 
 withProblemBuilder (callable $builder)
 
 getErrorMessage ($value)
 Get the problem message. More...
 
 getLngClosure ()
 Get the closure to be passed to the error-function that does i18n and sprintf. More...
 

Variables

trait DeriveApplyToFromTransform
 
trait DeriveInvokeFromTransform
 
trait DeriveTransformFromApplyTo
 
trait ProblemBuilder
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Function Documentation

◆ __invoke()

ILIAS\Refinery\__invoke (   $from)

Definition at line 36 of file DeriveInvokeFromTransform.php.

Referenced by ilInitialisation\getClientIdTransformation().

37  {
38  return $this->transform($from);
39  }
+ Here is the caller graph for this function:

◆ applyTo()

ILIAS\Refinery\applyTo ( Result  $result)

Definition at line 38 of file DeriveApplyToFromTransform.php.

References ILIAS\Data\Result\then().

Referenced by ilInitialisation\getClientIdTransformation(), ILIAS\UI\Implementation\Component\Input\Field\Tag\isClientSideValueOk(), ILIAS\Tests\Refinery\IdentityTransformationTest\testApplyToError(), and ILIAS\Tests\Refinery\IdentityTransformationTest\testApplyToOk().

38  : Result
39  {
40  return $result->then(function ($value): Result {
41  try {
42  return new Ok($this->transform($value));
43  } catch (Exception $exception) {
44  return new Error($exception);
45  }
46  });
47  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getErrorMessage()

ILIAS\Refinery\getErrorMessage (   $value)
final

Get the problem message.

Parameters
mixed$value
Returns
string

Definition at line 48 of file ProblemBuilder.php.

References ILIAS\$error, and ILIAS\Refinery\getLngClosure().

Referenced by ILIAS\Refinery\To\Transformation\BooleanTransformation\check(), ILIAS\Refinery\To\Transformation\FloatTransformation\check(), ILIAS\Refinery\To\Transformation\StringTransformation\check(), ILIAS\Refinery\To\Transformation\IntegerTransformation\check(), ILIAS\Refinery\To\Transformation\DateTimeTransformation\check(), ILIAS\Refinery\To\Transformation\ListTransformation\check(), ILIAS\Refinery\To\Transformation\DictionaryTransformation\check(), ILIAS\Refinery\Custom\Constraint\check(), ILIAS\Refinery\To\Transformation\TupleTransformation\check(), ILIAS\Refinery\To\Transformation\RecordTransformation\check(), ILIAS\Refinery\To\Transformation\BooleanTransformation\problemWith(), ILIAS\Refinery\To\Transformation\StringTransformation\problemWith(), ILIAS\Refinery\To\Transformation\FloatTransformation\problemWith(), ILIAS\Refinery\To\Transformation\IntegerTransformation\problemWith(), ILIAS\Refinery\To\Transformation\DateTimeTransformation\problemWith(), ILIAS\Refinery\To\Transformation\ListTransformation\problemWith(), ILIAS\Refinery\Custom\Constraint\problemWith(), ILIAS\Refinery\To\Transformation\DictionaryTransformation\problemWith(), ILIAS\Refinery\To\Transformation\TupleTransformation\problemWith(), ILIAS\Refinery\To\Transformation\RecordTransformation\problemWith(), ilObjPrivacySecurityGUI\save_privacy(), and ILIAS\Refinery\ByTrying\transform().

48  : string
49  {
50  $error = $this->getError();
51  if (!is_callable($error)) {
52  return $error;
53  }
54  $lng_closure = $this->getLngClosure();
55  return call_user_func($this->error, $lng_closure, $value);
56  }
getLngClosure()
Get the closure to be passed to the error-function that does i18n and sprintf.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLngClosure()

ILIAS\Refinery\getLngClosure ( )
finalprotected

Get the closure to be passed to the error-function that does i18n and sprintf.

Returns
Closure

Definition at line 62 of file ProblemBuilder.php.

References ILIAS\$error, $i, and ILIAS\Repository\lng().

Referenced by MyValidationConstraintsConstraint\_getLngClosure(), and ILIAS\Refinery\getErrorMessage().

62  : Closure
63  {
64  return function () {
65  $args = func_get_args();
66  if (count($args) < 1) {
67  throw new InvalidArgumentException(
68  "Expected an id of a lang var as first parameter"
69  );
70  }
71 
72  $error = $this->lng->txt($args[0]);
73  if (count($args) > 1) {
74  $args[0] = $error;
75  for ($i = 0, $numArgs = count($args); $i < $numArgs; $i++) {
76  $v = $args[$i];
77  if (is_array($v) || is_null($v) || (is_object($v) && !method_exists($v, "__toString"))) {
78  if (is_array($v)) {
79  $args[$i] = "array";
80  } elseif (is_null($v)) {
81  $args[$i] = "null";
82  } else {
83  $args[$i] = get_class($v);
84  }
85  }
86  }
87  $error = sprintf(...$args);
88  }
89 
90  return $error;
91  };
92  }
$i
Definition: metadata.php:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ withProblemBuilder()

ILIAS\Refinery\withProblemBuilder ( callable  $builder)
final

Definition at line 36 of file ProblemBuilder.php.

Referenced by ILIAS\UI\Implementation\Component\Input\Field\Tag\getConstraintForRequirement().

36  : self
37  {
38  $clone = clone $this;
39  $clone->error = $builder;
40  return $clone;
41  }
+ Here is the caller graph for this function:

Variable Documentation

◆ DeriveApplyToFromTransform

trait ILIAS::Refinery\DeriveApplyToFromTransform
Initial value:
{
abstract public function transform($from)

Definition at line 29 of file DeriveApplyToFromTransform.php.

◆ DeriveInvokeFromTransform

trait ILIAS::Refinery\DeriveInvokeFromTransform
Initial value:
{
abstract public function transform($from)

Definition at line 27 of file DeriveInvokeFromTransform.php.

◆ DeriveTransformFromApplyTo

trait ILIAS::Refinery\DeriveTransformFromApplyTo
Initial value:
{
abstract public function applyTo(Result $result): Result

Definition at line 27 of file DeriveTransformFromApplyTo.php.

◆ ProblemBuilder

trait ILIAS::Refinery\ProblemBuilder
Initial value:
{
abstract protected function getError()

Definition at line 27 of file ProblemBuilder.php.