Skip to content
This repository was archived by the owner on Dec 31, 2022. It is now read-only.

Commit 124169b

Browse files
committed
improve code
1 parent b49db76 commit 124169b

File tree

7 files changed

+14
-7
lines changed

7 files changed

+14
-7
lines changed

src/HeaderDate.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
/**
1515
* Import classes
1616
*/
17+
use DateTime;
1718
use DateTimeInterface;
1819
use DateTimeZone;
1920

@@ -82,6 +83,6 @@ public function getFieldValue() : string
8283
{
8384
$this->getTimestamp()->setTimezone(new DateTimeZone('GMT'));
8485

85-
return $this->getTimestamp()->format(DateTimeInterface::RFC822);
86+
return $this->getTimestamp()->format(DateTime::RFC822);
8687
}
8788
}

src/HeaderExpires.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
/**
1515
* Import classes
1616
*/
17+
use DateTime;
1718
use DateTimeInterface;
1819
use DateTimeZone;
1920

@@ -82,6 +83,6 @@ public function getFieldValue() : string
8283
{
8384
$this->getTimestamp()->setTimezone(new DateTimeZone('GMT'));
8485

85-
return $this->getTimestamp()->format(DateTimeInterface::RFC822);
86+
return $this->getTimestamp()->format(DateTime::RFC822);
8687
}
8788
}

src/HeaderLastModified.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
/**
1515
* Import classes
1616
*/
17+
use DateTime;
1718
use DateTimeInterface;
1819
use DateTimeZone;
1920

@@ -82,6 +83,6 @@ public function getFieldValue() : string
8283
{
8384
$this->getTimestamp()->setTimezone(new DateTimeZone('GMT'));
8485

85-
return $this->getTimestamp()->format(DateTimeInterface::RFC822);
86+
return $this->getTimestamp()->format(DateTime::RFC822);
8687
}
8788
}

src/HeaderRetryAfter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
/**
1515
* Import classes
1616
*/
17+
use DateTime;
1718
use DateTimeInterface;
1819
use DateTimeZone;
1920

@@ -82,6 +83,6 @@ public function getFieldValue() : string
8283
{
8384
$this->getTimestamp()->setTimezone(new DateTimeZone('GMT'));
8485

85-
return $this->getTimestamp()->format(DateTimeInterface::RFC822);
86+
return $this->getTimestamp()->format(DateTime::RFC822);
8687
}
8788
}

src/HeaderSetCookie.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
/**
1515
* Import classes
1616
*/
17+
use DateTime;
1718
use DateTimeInterface;
1819
use DateTimeZone;
1920
use InvalidArgumentException;
@@ -375,7 +376,7 @@ public function getFieldValue() : string
375376
if ($this->getExpires() instanceof DateTimeInterface) {
376377
$this->getExpires()->setTimezone(new DateTimeZone('GMT'));
377378

378-
$result .= '; Expires=' . $this->getExpires()->format(DateTimeInterface::RFC822);
379+
$result .= '; Expires=' . $this->getExpires()->format(DateTime::RFC822);
379380
$result .= '; Max-Age=' . ($this->getExpires()->getTimestamp() - time());
380381
}
381382

src/HeaderSunset.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
/**
1515
* Import classes
1616
*/
17+
use DateTime;
1718
use DateTimeInterface;
1819
use DateTimeZone;
1920

@@ -82,6 +83,6 @@ public function getFieldValue() : string
8283
{
8384
$this->getTimestamp()->setTimezone(new DateTimeZone('GMT'));
8485

85-
return $this->getTimestamp()->format(DateTimeInterface::RFC822);
86+
return $this->getTimestamp()->format(DateTime::RFC822);
8687
}
8788
}

src/HeaderWarning.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
/**
1515
* Import classes
1616
*/
17+
use DateTime;
1718
use DateTimeInterface;
1819
use DateTimeZone;
1920
use InvalidArgumentException;
@@ -226,7 +227,7 @@ public function getFieldValue() : string
226227
if ($this->getDate() instanceof DateTimeInterface) {
227228
$this->getDate()->setTimezone(new DateTimeZone('GMT'));
228229

229-
$result .= ' "' . $this->getDate()->format(DateTimeInterface::RFC822) . '"';
230+
$result .= ' "' . $this->getDate()->format(DateTime::RFC822) . '"';
230231
}
231232

232233
return $result;

0 commit comments

Comments
 (0)