for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Graze\CiffRenderer\Field\Parser\DateParser;
use Graze\CiffRenderer\Field\Parser\FixedTextParser;
use Graze\CiffRenderer\Field\Parser\DateParser\DateFormatter\DateFormatterFactory;
use Graze\CiffRenderer\Exception\UnsupportedDateFormatException;
abstract class AbstractDateParser extends FixedTextParser
{
/**
* @return string
*
* @throws UnsupportedDateFormatException
*/
public function getText()
try {
$dateFormat = $this->getDateFormat();
$dateFormatter = DateFormatterFactory::getFormatter($dateFormat);
return $dateFormatter->format(
$this->getDateTime(),
$dateFormat
);
} catch (\Exception $e) {
throw new UnsupportedDateFormatException($this->getDateFormat());
}
* Fetch a DateTime object set to the correct date/time.
* @return DateTimeInterface
abstract protected function getDateTime();
public function getDateFormat()
return (string) $this->xmlField->Data->Object->Default;