<?php
namespace Whater\Domain\Whater\Model;
use BornFree\TacticianDomainEvent\Recorder\ContainsRecordedEvents;
use BornFree\TacticianDomainEvent\Recorder\EventRecorderCapabilities;
use Ramsey\Uuid\Uuid;
use Whater\Domain\Common\Exception\InvalidUUIDException;
/**
* Class LogFiles
*
* @package Whater\Domain\Whater\Model
*/
class LogFiles implements ContainsRecordedEvents
{
use EventRecorderCapabilities;
/**
* @var string
*/
private $uuid;
/**
* @var string
*/
private $filePath;
/**
* @var string
*/
private $fileName;
/**
* @var \DateTime
*/
private $createdAt;
/**
* @param string $filePath
* @param string $fileName
*/
public function __construct(
string $filePath = null,
string $fileName = null
) {
try {
$this->uuid = Uuid::fromString(Uuid::uuid4())->toString();
} catch (\InvalidArgumentException $e) {
throw new InvalidUUIDException();
}
$this->filePath = $filePath;
$this->fileName = $fileName;
$this->createdAt = new \DateTime();
}
/**
* @return string
*/
public function id(): string
{
return $this->uuid;
}
/**
* @return string
*/
public function filePath(): string
{
return $this->filePath;
}
/**
* @return string
*/
public function fileName(): string
{
return $this->fileName;
}
}