MediaObjectInterface.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php declare(strict_types=1);
  2. namespace Grav\Framework\Contracts\Media;
  3. use Grav\Framework\Contracts\Object\IdentifierInterface;
  4. use Psr\Http\Message\ResponseInterface;
  5. /**
  6. * Media Object Interface
  7. */
  8. interface MediaObjectInterface extends IdentifierInterface
  9. {
  10. /**
  11. * Returns true if the object exists.
  12. *
  13. * @return bool
  14. * @phpstan-pure
  15. */
  16. public function exists(): bool;
  17. /**
  18. * Get metadata associated to the media object.
  19. *
  20. * @return array
  21. * @phpstan-pure
  22. */
  23. public function getMeta(): array;
  24. /**
  25. * @param string $field
  26. * @return mixed
  27. * @phpstan-pure
  28. */
  29. public function get(string $field);
  30. /**
  31. * Return URL pointing to the media object.
  32. *
  33. * @return string
  34. * @phpstan-pure
  35. */
  36. public function getUrl(): string;
  37. /**
  38. * Create media response.
  39. *
  40. * @param array $actions
  41. * @return ResponseInterface
  42. * @phpstan-pure
  43. */
  44. public function createResponse(array $actions): ResponseInterface;
  45. }