ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ILIAS\LegalDocuments\ConsumerToolbox\Marshal Class Reference
+ Collaboration diagram for ILIAS\LegalDocuments\ConsumerToolbox\Marshal:

Public Member Functions

 __construct (private readonly Refinery $refinery)
 
 dateTime ()
 
 boolean ()
 
 nullable (Convert $convert)
 
 string ()
 

Private Member Functions

 custom (Closure $map)
 
 error (string $message)
 

Detailed Description

Definition at line 29 of file Marshal.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\LegalDocuments\ConsumerToolbox\Marshal::__construct ( private readonly Refinery  $refinery)

Definition at line 31 of file Marshal.php.

32  {
33  }

Member Function Documentation

◆ boolean()

ILIAS\LegalDocuments\ConsumerToolbox\Marshal::boolean ( )

Definition at line 47 of file Marshal.php.

References ILIAS\LegalDocuments\ConsumerToolbox\Marshal\custom(), ILIAS\LegalDocuments\ConsumerToolbox\Marshal\error(), and ILIAS\Repository\refinery().

Referenced by ILIAS\TermsOfService\Settings\boolean(), ILIAS\DataProtection\Settings\boolean(), ILIAS\DataProtection\UserSettings\withdrawalRequested(), and ILIAS\TermsOfService\UserSettings\withdrawalRequested().

47  : Convert
48  {
49  // kindlyTo()->bool() doesn't count an empty string as `false`:
50  $from = $this->refinery->byTrying([
51  $this->refinery->kindlyTo()->bool(),
52  $this->custom(fn(string $s): bool => !($s === '' || $this->error('Value could not be transformed to bool.')))
53  ]);
54 
55  $to = $this->refinery->kindlyTo()->string();
56 
57  return new Convert($from, $to);
58  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ custom()

ILIAS\LegalDocuments\ConsumerToolbox\Marshal::custom ( Closure  $map)
private

Definition at line 83 of file Marshal.php.

References ILIAS\Repository\refinery().

Referenced by ILIAS\LegalDocuments\ConsumerToolbox\Marshal\boolean(), and ILIAS\LegalDocuments\ConsumerToolbox\Marshal\dateTime().

83  : Transformation
84  {
85  return $this->refinery->custom()->transformation($map);
86  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dateTime()

ILIAS\LegalDocuments\ConsumerToolbox\Marshal::dateTime ( )

Definition at line 35 of file Marshal.php.

References ILIAS\LegalDocuments\ConsumerToolbox\Marshal\custom(), and ILIAS\Repository\refinery().

Referenced by ILIAS\DataProtection\UserSettings\agreeDate(), ILIAS\DataProtection\Settings\lastResetDate(), and ILIAS\TermsOfService\Settings\lastResetDate().

35  : Convert
36  {
37  $from = $this->refinery->in()->series([
38  $this->custom(fn(string $s) => '@' . ($s ?: '0')),
39  $this->refinery->to()->dateTime(),
40  ]);
41 
42  $to = $this->custom(fn(DateTimeImmutable $x) => (string) $x->getTimeStamp());
43 
44  return new Convert($from, $to);
45  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ error()

ILIAS\LegalDocuments\ConsumerToolbox\Marshal::error ( string  $message)
private

Definition at line 88 of file Marshal.php.

Referenced by ILIAS\LegalDocuments\ConsumerToolbox\Marshal\boolean().

88  : void
89  {
90  throw new Exception($message);
91  }
$message
Definition: xapiexit.php:31
+ Here is the caller graph for this function:

◆ nullable()

ILIAS\LegalDocuments\ConsumerToolbox\Marshal::nullable ( Convert  $convert)

Definition at line 60 of file Marshal.php.

References ILIAS\LegalDocuments\ConsumerToolbox\Convert\fromString(), ILIAS\Repository\refinery(), and ILIAS\LegalDocuments\ConsumerToolbox\Convert\toString().

Referenced by ILIAS\DataProtection\UserSettings\agreeDate(), and ILIAS\LegalDocuments\ConsumerToolbox\Routing\originalTarget().

60  : Convert
61  {
62  $from = $this->refinery->byTrying([
63  $this->refinery->kindlyTo()->null(),
64  $convert->fromString(),
65  ]);
66 
67  $to = $this->refinery->byTrying([
68  $this->refinery->in()->series([$this->refinery->null(), $this->refinery->always('')]),
69  $convert->toString(),
70  ]);
71 
72  return new Convert($from, $to);
73  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ string()

ILIAS\LegalDocuments\ConsumerToolbox\Marshal::string ( )

Definition at line 75 of file Marshal.php.

References ILIAS\Repository\refinery().

Referenced by ILIAS\DataProtection\Settings\adminEmail(), ILIAS\TermsOfService\Settings\adminEmail(), ILIAS\TermsOfService\Settings\authMode(), ILIAS\DataProtection\Settings\authMode(), and ILIAS\LegalDocuments\ConsumerToolbox\Routing\originalTarget().

75  : Convert
76  {
77  return new Convert(
78  $this->refinery->identity(),
79  $this->refinery->identity()
80  );
81  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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