GalleryImage.php 996 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. $this->type = isset($props['type']) ? $props['type'] : '';
  25. }
  26. /**
  27. * @param string $version
  28. *
  29. * @return string
  30. */
  31. public function getUrl($version)
  32. {
  33. return $this->galleryBehavior->getUrl($this->id, $version);
  34. }
  35. }