Skip to content

Commit 1938f73

Browse files
committed
Deprecates unused methods and refactors date formatting
Replaces deprecated `Functions::$DateFormat` and `Functions::$DateTimeFormat` with the new `Date::$format` for improved consistency and maintainability. Removes numerous deprecated methods across multiple classes to reduce code clutter and improve readability. Updates versioning and internal comments to reflect the latest changes. Adjusts shell scripts for proper handling of version strings.
1 parent 51ddc73 commit 1938f73

File tree

8 files changed

+23
-444
lines changed

8 files changed

+23
-444
lines changed

src/AbraFlexi/Date.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ class Date extends \DateTime
2626
*/
2727
public bool $isNull = false;
2828

29+
/**
30+
* Formating string for \DateTime::format() for date columns.
31+
*/
32+
public static string $format = 'Y-m-d';
33+
2934
/**
3035
* AbraFlexi date to PHP DateTime conversion.
3136
*
@@ -39,11 +44,11 @@ public function __construct(string $flexidate = 'NOW')
3944
$format = '';
4045

4146
if (strstr($flexidate, '+')) {
42-
$format = Functions::$DateFormat.'T';
47+
$format = self::$format.'T';
4348
} elseif (strstr($flexidate, 'Z')) {
44-
$format = Functions::$DateFormat.'Z';
49+
$format = self::$format.'Z';
4550
} elseif (!empty($flexidate) && ($flexidate !== 'NOW')) {
46-
$format = Functions::$DateFormat;
51+
$format = self::$format;
4752

4853
if (strstr($flexidate, ':')) {
4954
$format .= '-i:s';
@@ -63,7 +68,7 @@ public function __construct(string $flexidate = 'NOW')
6368
*/
6469
public function __toString(): string
6570
{
66-
return $this->isNull ? '' : $this->format(Functions::$DateFormat);
71+
return $this->isNull ? '' : $this->format(self::$format);
6772
}
6873

6974
/**

src/AbraFlexi/EvidenceList.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3022,16 +3022,6 @@ public function __construct($init = null, $options = [])
30223022
parent::__construct($init, $options);
30233023
}
30243024

3025-
/**
3026-
* There is not ID.
3027-
*
3028-
* @deprecated since version 1.24 - use getRecordCode() instead
3029-
*/
3030-
public function getRecordID()
3031-
{
3032-
return null;
3033-
}
3034-
30353025
/**
30363026
* {@inheritDoc}
30373027
*/

src/AbraFlexi/Functions.php

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,9 @@ class Functions
2323
{
2424
/**
2525
* Where to get JSON files with evidence structure etc.
26-
*
27-
* @deprecated since version 3.3.0 - use Functions::$infoDir instead
2826
*/
2927
public static string $infoDir = __DIR__.'/../../static';
3028

31-
/**
32-
* Formating string for \DateTime::format() for datetime columns.
33-
*
34-
* @deprecated since version 2.17
35-
*/
36-
public static string $DateTimeFormat = 'Y-m-d\TH:i:s.u+P';
37-
38-
/**
39-
* Formating string for \DateTime::format() for date columns.
40-
*
41-
* @deprecated since version 2.17
42-
*/
43-
public static string $DateFormat = 'Y-m-d';
44-
4529
/**
4630
* convert unicode to entities for use with AbraFlexi queries.
4731
*
@@ -238,15 +222,15 @@ public static function flexiUrl(array $data, $joiner = 'and', $defop = 'eq'): st
238222
*/
239223
public static function dateToFlexiDate(\DateTime $date)
240224
{
241-
return $date->format(self::$DateFormat);
225+
return $date->format(Date::$format);
242226
}
243227

244228
/**
245229
* PHP Date object to AbraFlexi date format.
246230
*/
247231
public static function dateToFlexiDateTime(\DateTime $dateTime)
248232
{
249-
return $dateTime->format(self::$DateTimeFormat);
233+
return $dateTime->format(DateTime::$format);
250234
}
251235

252236
/**
@@ -259,11 +243,11 @@ public static function dateToFlexiDateTime(\DateTime $dateTime)
259243
public static function flexiDateToDateTime(string $flexidate)
260244
{
261245
if (strstr($flexidate, '+')) {
262-
$format = self::$DateFormat.'O';
246+
$format = Date::$format.'O';
263247
} elseif (strstr($flexidate, 'Z')) {
264-
$format = self::$DateFormat.'Z';
248+
$format = Date::$format.'Z';
265249
} else {
266-
$format = self::$DateFormat;
250+
$format = Date::$format;
267251
}
268252

269253
return \DateTime::createFromFormat($format, $flexidate)->setTime(0, 0);
@@ -279,7 +263,7 @@ public static function flexiDateToDateTime(string $flexidate)
279263
public static function flexiDateTimeToDateTime(string $flexidatetime)
280264
{
281265
if (strstr($flexidatetime, '.')) { // NewFormat
282-
$format = self::$DateTimeFormat;
266+
$format = DateTime::$format;
283267
} else { // Old format
284268
$format = 'Y-m-d\TH:i:s+P';
285269
}

0 commit comments

Comments
 (0)