From 99dcf0690421975dbc37339508ef6e0dfcc19e30 Mon Sep 17 00:00:00 2001 From: aleksandr Date: Wed, 2 Oct 2024 17:04:28 +0900 Subject: [PATCH] change version number, add change log, change logic of returning constants --- CHANGELOG.md | 3 +++ controller.php | 2 +- src/User/Exporter.php | 32 ++++++-------------------------- 3 files changed, 10 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1ce376..da3f618 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ # Release Notes +## [0.9.1 (Oct 2, 2024)] + +- Fixed the use of export options for date formatting ## [0.9.0 (Aug 18, 2022)] diff --git a/controller.php b/controller.php index e3d03f8..f1f2f37 100644 --- a/controller.php +++ b/controller.php @@ -19,7 +19,7 @@ class Controller extends Package /** * @var string package version */ - protected $pkgVersion = '0.9.0'; + protected $pkgVersion = '0.9.1'; /** * {@inheritdoc} diff --git a/src/User/Exporter.php b/src/User/Exporter.php index 3de0214..87c50dc 100644 --- a/src/User/Exporter.php +++ b/src/User/Exporter.php @@ -231,32 +231,12 @@ protected function getRecords(): \Generator protected function getFormatByName(string $formatName = 'ATOM') { - switch ($formatName) { - case 'COOKIE': - return DATE_COOKIE; - case 'RFC822': - return DATE_RFC822; - case 'RFC850': - return DATE_RFC850; - case 'RFC1036': - return DATE_RFC1036; - case 'RFC1123': - return DATE_RFC1123; - case 'RFC7231': - return DATE_RFC7231; - case 'RFC2822': - return DATE_RFC2822; - case 'RFC3339': - return DATE_RFC3339; - case 'RFC3339_EXTENDED': - return DATE_RFC3339_EXTENDED; - case 'RSS': - return DATE_RSS; - case 'W3C': - return DATE_W3C; - case 'ATOM': - default: - return DATE_ATOM; + $datetime_format_constant = sprintf('DATE_%s', $formatName); + + if (defined($datetime_format_constant)) { + return constant($datetime_format_constant); } + + return DATE_ATOM; } }