Yosymfony\Spress\Core\ContentManager\Permalink\PermalinkGenerator::getDateAttribute PHP Method

getDateAttribute() private method

private getDateAttribute ( Yosymfony\Spress\Core\DataSource\ItemInterface $item )
$item Yosymfony\Spress\Core\DataSource\ItemInterface
    private function getDateAttribute(ItemInterface $item)
    {
        $attributes = $item->getAttributes();
        if (isset($attributes['date']) === false) {
            throw new MissingAttributeException('Attribute date required.', 'date', $item->getPath());
        }
        if (is_string($attributes['date']) === false) {
            throw new AttributeValueException('Invalid value. Expected date string.', 'date', $item->getPath());
        }
        try {
            return new \DateTime($attributes['date']);
        } catch (\Exception $e) {
            throw new AttributeValueException('Invalid value. Expected date string.', 'date', $item->getPath());
        }
    }