ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
FormatBuilder.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 
4 namespace ILIAS\Data\DateFormat;
5 
11 {
12  private $format = [];
13 
17  public function get() : DateFormat
18  {
19  $df = new DateFormat($this->format);
20  $this->format = [];
21  return $df;
22  }
23 
27  public function dot() : FormatBuilder
28  {
29  $this->format[] = DateFormat::DOT;
30  return $this;
31  }
32  public function comma() : FormatBuilder
33  {
34  $this->format[] = DateFormat::COMMA;
35  return $this;
36  }
37  public function dash() : FormatBuilder
38  {
39  $this->format[] = DateFormat::DASH;
40  return $this;
41  }
42  public function slash() : FormatBuilder
43  {
44  $this->format[] = DateFormat::SLASH;
45  return $this;
46  }
47  public function space() : FormatBuilder
48  {
49  $this->format[] = DateFormat::SPACE;
50  return $this;
51  }
52  public function day() : FormatBuilder
53  {
54  $this->format[] = DateFormat::DAY;
55  return $this;
56  }
57  public function dayOrdinal() : FormatBuilder
58  {
59  $this->format[] = DateFormat::DAY_ORDINAL;
60  return $this;
61  }
62  public function weekday() : FormatBuilder
63  {
64  $this->format[] = DateFormat::WEEKDAY;
65  return $this;
66  }
67  public function weekdayShort() : FormatBuilder
68  {
69  $this->format[] = DateFormat::WEEKDAY_SHORT;
70  return $this;
71  }
72  public function week() : FormatBuilder
73  {
74  $this->format[] = DateFormat::WEEK;
75  return $this;
76  }
77  public function month() : FormatBuilder
78  {
79  $this->format[] = DateFormat::MONTH;
80  return $this;
81  }
82  public function monthSpelled() : FormatBuilder
83  {
84  $this->format[] = DateFormat::MONTH_SPELLED;
85  return $this;
86  }
87  public function monthSpelledShort() : FormatBuilder
88  {
89  $this->format[] = DateFormat::MONTH_SPELLED_SHORT;
90  return $this;
91  }
92  public function year() : FormatBuilder
93  {
94  $this->format[] = DateFormat::YEAR;
95  return $this;
96  }
97  public function twoDigitYear() : FormatBuilder
98  {
99  $this->format[] = DateFormat::YEAR_TWO_DIG;
100  return $this;
101  }
102 }
dot()
Append tokens to format.
Builds a Date Format with split up elements to ease conversion.