GalleryImage.php 935 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace app\forks\galleryManager;
  3. class GalleryImage
  4. {
  5. public $name;
  6. public $description;
  7. public $id;
  8. public $rank;
  9. /**
  10. * @var GalleryBehavior
  11. */
  12. protected $galleryBehavior;
  13. /**
  14. * @param GalleryBehavior $galleryBehavior
  15. * @param array $props
  16. */
  17. function __construct(GalleryBehavior $galleryBehavior, array $props)
  18. {
  19. $this->galleryBehavior = $galleryBehavior;
  20. $this->name = isset($props['name']) ? $props['name'] : '';
  21. $this->description = isset($props['description']) ? $props['description'] : '';
  22. $this->id = isset($props['id']) ? $props['id'] : '';
  23. $this->rank = isset($props['rank']) ? $props['rank'] : '';
  24. }
  25. /**
  26. * @param string $version
  27. *
  28. * @return string
  29. */
  30. public function getUrl($version)
  31. {
  32. return $this->galleryBehavior->getUrl($this->id, $version);
  33. }
  34. }