1 | <?php |
||
8 | class Icon implements \ArrayAccess, \Countable |
||
9 | { |
||
10 | /** |
||
11 | * @var IconImage[] |
||
12 | */ |
||
13 | private $images = []; |
||
14 | |||
15 | /** |
||
16 | * Returns best icon image with dimensions matching w,h |
||
17 | * @param $w |
||
18 | * @param $h |
||
19 | * @return IconImage|null |
||
20 | */ |
||
21 | 1 | public function findBestForSize($w, $h) |
|
33 | |||
34 | /** |
||
35 | * Finds the highest quality image in the icon |
||
36 | * @return IconImage|null |
||
37 | */ |
||
38 | 1 | public function findBest() |
|
54 | |||
55 | /** |
||
56 | * Count number of images in the icon |
||
57 | * As this class implements Countable you can simply use count($icon) if you desire |
||
58 | * @return int |
||
59 | */ |
||
60 | 15 | public function count() |
|
64 | |||
65 | /** |
||
66 | * Set an icon |
||
67 | * This is an implementation of ArrayAccess allowing you to do $icon[$x]=$image |
||
68 | * @param integer $offset |
||
69 | * @param IconImage $value |
||
70 | */ |
||
71 | 15 | public function offsetSet($offset, $value) |
|
82 | |||
83 | /** |
||
84 | * Check if image with particular index exists |
||
85 | * This is an implementation of ArrayAccess allowing you to do isset($icon[$x]) |
||
86 | * @param integer $offset |
||
87 | * @return boolean |
||
88 | */ |
||
89 | public function offsetExists($offset) |
||
93 | |||
94 | /** |
||
95 | * Remove image from icon |
||
96 | * This is an implementation of ArrayAccess allowing you to do unset($icon[$x]) |
||
97 | * @param integer $offset |
||
98 | * @return boolean |
||
99 | */ |
||
100 | public function offsetUnset($offset) |
||
104 | |||
105 | /** |
||
106 | * Get image from icon |
||
107 | * This is an implementation of ArrayAccess allowing you to do $image = $icon[$x] |
||
108 | * @param integer $offset |
||
109 | * @return IconImage |
||
110 | */ |
||
111 | 15 | public function offsetGet($offset) |
|
115 | } |
||
116 |