| Total Complexity | 2 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | trait DateTrait |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * The format that should be used when determining how to parse a date from a date string. |
||
| 20 | * |
||
| 21 | * @var string |
||
| 22 | */ |
||
| 23 | protected $createFromFormat; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * The preferred timezone to use for date output. |
||
| 27 | * |
||
| 28 | * @var string |
||
| 29 | */ |
||
| 30 | protected $outputTimezone; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Allows the user to help the date parser by providing the format of the datestamp in the feed. |
||
| 34 | * |
||
| 35 | * This will be passed into `DateTime::createFromFormat()` at parse-time. |
||
| 36 | * |
||
| 37 | * @param string $createFromFormat The format of the datestamp in the feed. |
||
| 38 | * |
||
| 39 | * @see http://php.net/manual/en/datetime.createfromformat.php |
||
| 40 | */ |
||
| 41 | 1 | public function setDateFormat(string $createFromFormat): self |
|
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Set the preferred output timezone. |
||
| 50 | * |
||
| 51 | * This calculation is performed on a _best-effort_ basis and is not guaranteed. Factors which may affect the |
||
| 52 | * calculation include: |
||
| 53 | * |
||
| 54 | * * the version of glibc/musl that your OS relies on |
||
| 55 | * * the freshness of the timestamp data your OS relies on |
||
| 56 | * * the format of the datestamp inside of the feed and PHP's ability to parse it |
||
| 57 | * |
||
| 58 | * @param string $timezone The timezone identifier to use. Must be compatible with `DateTimeZone`. The default |
||
| 59 | * value is `UTC`. |
||
| 60 | */ |
||
| 61 | 1 | public function setOutputTimezone(string $timezone = 'UTC'): self |
|
| 68 |