PlainTextEntity.php 607 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace Benchmark\Entities;
  3. use Hamlet\Entities\AbstractEntity;
  4. class PlainTextEntity extends AbstractEntity
  5. {
  6. private $content;
  7. public function __construct(string $content)
  8. {
  9. $this->content = $content;
  10. }
  11. public function getContent(): string
  12. {
  13. return $this->content;
  14. }
  15. /**
  16. * Get cache key of the entity
  17. */
  18. public function getKey(): string
  19. {
  20. return md5($this->content);
  21. }
  22. /**
  23. * Get media type
  24. * @return string|null
  25. */
  26. public function getMediaType()
  27. {
  28. return 'text/plain';
  29. }
  30. }