Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: dfddfeaf27
Fetching contributors…

Cannot retrieve contributors at this time

39 lines (30 sloc) 0.773 kb
<?php
namespace FreeAgent\Bitter\UnitOfTime;
use \DateTime;
use \Exception;
/**
* @author Jérémy Romey <jeremy@free-agent.fr>
*/
abstract class AbstractUnitOfTime
{
protected $eventName;
protected $dateTime;
public function __construct($eventName, DateTime $dateTime = null)
{
$this->eventName = $eventName;
$this->dateTime = is_null($dateTime) ? new DateTime : $dateTime;
}
public function getUnitOfTimeName()
{
return $this->eventName;
}
public function getDateTime()
{
return $this->dateTime;
}
abstract public function getDateTimeFormated();
public function getKey()
{
return sprintf('%s:%s', $this->getUnitOfTimeName(), $this->getDateTimeFormated());
}
}
Jump to Line
Something went wrong with that request. Please try again.