Total Complexity | 9 |
Total Lines | 55 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php namespace FlatPlan\Components; |
||
5 | class Gallery extends AbstractComponent { |
||
6 | |||
7 | private $role; |
||
8 | private $items = array(); |
||
9 | |||
10 | protected $roles = ['gallery', 'mosaic']; |
||
11 | |||
12 | /** |
||
13 | * @param string $role |
||
14 | * @param string $bannerType |
||
15 | * @return void |
||
16 | */ |
||
17 | public function __construct($role) |
||
18 | { |
||
19 | $this->setRole($role); |
||
20 | } |
||
21 | |||
22 | public function setRole($role) |
||
23 | { |
||
24 | if (!in_array($role, $this->roles)) { |
||
25 | throw new \ErrorException('Invalid role supplied.'); |
||
26 | } |
||
27 | $this->role = $role; |
||
28 | } |
||
29 | |||
30 | public function getRole() |
||
31 | { |
||
32 | return $this->role; |
||
33 | } |
||
34 | |||
35 | public function setItem($item) |
||
36 | { |
||
37 | if ($item instanceof Image) { |
||
38 | array_push($this->items, $item); |
||
39 | } else { |
||
40 | throw new \ErrorException('Invalid image component supplied.'); |
||
41 | } |
||
42 | } |
||
43 | |||
44 | public function getItems() |
||
45 | { |
||
46 | return $this->items; |
||
47 | } |
||
48 | |||
49 | public function getComponent() |
||
55 | } |
||
56 | |||
57 | public function __toString() |
||
58 | { |
||
60 | } |
||
61 | } |
||
62 |