mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2026-10-30 17:22:08 +00:00
Added draft for history
This commit is contained in:
1 parent
463003f029
commit
6d146c8478
7 files changed
+170
No files matched your search
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Infinito\Attribut;
|
||||
|
||||
use Infinito\Exception\AllreadySetException;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*
|
||||
* @see TimestampAttributInterface
|
||||
*/
|
||||
trait TimestampAttribut
|
||||
{
|
||||
/**
|
||||
* @var \DateTime
|
||||
*/
|
||||
protected $timestamp;
|
||||
|
||||
/**
|
||||
* @param \DateTime $datetime
|
||||
*/
|
||||
public function setTimestamp(\DateTime $timestamp): void
|
||||
{
|
||||
if (isset($this->timestamp)) {
|
||||
throw new AllreadySetException('The timestamp is allready set. An Update is not possible!');
|
||||
}
|
||||
$this->timestamp = $timestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getTimestamp(): \DateTime
|
||||
{
|
||||
return $this->timestamp;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user