for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
/*
* This file is part of Symplify
* Copyright (c) 2016 Tomas Votruba (http://tomasvotruba.cz).
*/
namespace Symplify\PHP7_Sculpin\Renderable\File;
use DateTimeInterface;
use SplFileInfo;
use Symplify\PHP7_Sculpin\Utils\PathAnalyzer;
final class PostFile extends File
{
/**
* @var DateTimeInterface
private $date;
* @var string
private $filenameWithoutDate;
public function __construct(SplFileInfo $fileInfo, string $relativeSource)
parent::__construct($fileInfo, $relativeSource);
$this->date = PathAnalyzer::detectDate($this->fileInfo);
$this->filenameWithoutDate = PathAnalyzer::detectFilenameWithoutDate($this->fileInfo);
}
public function getDate() : DateTimeInterface
return $this->date;
public function getDateInFormat(string $format) : string
return $this->date->format($format);
public function getFilenameWithoutDate() : string
return $this->filenameWithoutDate;