forked from zxbodya/yii2-gallery-manager
-
Notifications
You must be signed in to change notification settings - Fork 2
/
GalleryImage.php
43 lines (35 loc) · 1 KB
/
GalleryImage.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
namespace aquy\gallery;
class GalleryImage
{
public $name;
public $description;
public $id;
public $sort;
public $src;
/**
* @var GalleryBehavior
*/
protected $galleryBehavior;
/**
* @param GalleryBehavior $galleryBehavior
* @param array $props
*/
function __construct(GalleryBehavior $galleryBehavior, array $props)
{
$this->galleryBehavior = $galleryBehavior;
$this->name = isset($props['name']) ? $props['name'] : '';
$this->description = isset($props['description']) ? $props['description'] : '';
$this->id = isset($props['id']) ? $props['id'] : '';
$this->sort = isset($props['sort']) ? $props['sort'] : '';
$this->src = isset($props['src']) ? $props['src'] : '';
}
public function getUrl()
{
return $this->galleryBehavior->getUrl($this->src);
}
public function getFilePath()
{
return $this->galleryBehavior->getFilePath($this->src);
}
}