src/Domain/Whater/Model/LogFiles.php line 15

Open in your IDE?
  1. <?php
  2. namespace Whater\Domain\Whater\Model;
  3. use BornFree\TacticianDomainEvent\Recorder\ContainsRecordedEvents;
  4. use BornFree\TacticianDomainEvent\Recorder\EventRecorderCapabilities;
  5. use Ramsey\Uuid\Uuid;
  6. use Whater\Domain\Common\Exception\InvalidUUIDException;
  7. /**
  8. * Class LogFiles
  9. *
  10. * @package Whater\Domain\Whater\Model
  11. */
  12. class LogFiles implements ContainsRecordedEvents
  13. {
  14. use EventRecorderCapabilities;
  15. /**
  16. * @var string
  17. */
  18. private $uuid;
  19. /**
  20. * @var string
  21. */
  22. private $filePath;
  23. /**
  24. * @var string
  25. */
  26. private $fileName;
  27. /**
  28. * @var \DateTime
  29. */
  30. private $createdAt;
  31. /**
  32. * @param string $filePath
  33. * @param string $fileName
  34. */
  35. public function __construct(
  36. string $filePath = null,
  37. string $fileName = null
  38. ) {
  39. try {
  40. $this->uuid = Uuid::fromString(Uuid::uuid4())->toString();
  41. } catch (\InvalidArgumentException $e) {
  42. throw new InvalidUUIDException();
  43. }
  44. $this->filePath = $filePath;
  45. $this->fileName = $fileName;
  46. $this->createdAt = new \DateTime();
  47. }
  48. /**
  49. * @return string
  50. */
  51. public function id(): string
  52. {
  53. return $this->uuid;
  54. }
  55. /**
  56. * @return string
  57. */
  58. public function filePath(): string
  59. {
  60. return $this->filePath;
  61. }
  62. /**
  63. * @return string
  64. */
  65. public function fileName(): string
  66. {
  67. return $this->fileName;
  68. }
  69. }