![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/demo.cartinsight.co/vendor/zbateson/mail-mime-parser/src/Header/ |
<?php /** * This file is part of the ZBateson\MailMimeParser project. * * @license http://opensource.org/licenses/bsd-license.php BSD */ namespace ZBateson\MailMimeParser\Header; use DateTimeImmutable; use ZBateson\MailMimeParser\Header\Consumer\ConsumerService; use ZBateson\MailMimeParser\Header\Part\DatePart; /** * Reads a DatePart value header in either RFC 2822 or RFC 822 format. * * @author Zaahid Bateson */ class DateHeader extends AbstractHeader { /** * Returns a DateConsumer. * * @return Consumer\AbstractConsumer */ protected function getConsumer(ConsumerService $consumerService) { return $consumerService->getDateConsumer(); } /** * Convenience method returning the part's DateTime object, or null if the * date could not be parsed. * * @return \DateTime|null The parsed DateTime object. */ public function getDateTime() : ?\DateTime { if (!empty($this->parts) && $this->parts[0] instanceof DatePart) { return $this->parts[0]->getDateTime(); } return null; } /** * Returns a DateTimeImmutable for the part's DateTime object, or null if * the date could not be parsed. * * @return DateTimeImmutable|null The parsed DateTimeImmutable object. */ public function getDateTimeImmutable() : ?\DateTimeImmutable { $dateTime = $this->getDateTime(); if ($dateTime !== null) { return DateTimeImmutable::createFromMutable($dateTime); } return null; } }