ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
DateTimeTransformation.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 2019 Nils Haagen <nils.haagen@concepts-and-training.de> Extended GPL, see docs/LICENSE */
3 
5 
11 
17 {
20 
24  private $factory;
25 
29  public function __construct(Factory $factory)
30  {
31  $this->factory = $factory;
32  }
33 
37  public function transform($from)
38  {
39  try {
40  return new \DateTimeImmutable($from);
41  } catch (\Exception $e) {
42  throw new \InvalidArgumentException($e->getMessage(), 1);
43  }
44  }
45 }
Builds data types.
Definition: Factory.php:19
Transform a string representing a datetime-value to php&#39;s DateTimeImmutable see https://www.php.net/manual/de/datetime.formats.php.
transform($from)
Perform the transformation.Please use this for transformations. It&#39;s more performant than calling inv...
A transformation is a function from one datatype to another.