1 | <?php |
||
21 | final class Image |
||
22 | { |
||
23 | const PURPOSE_BADGE = "badge"; |
||
24 | const PURPOSE_ANY = "any"; |
||
25 | |||
26 | private $purpose = [ ]; |
||
27 | private $sizes = [ ]; |
||
28 | private $src; |
||
29 | private $type; |
||
30 | |||
31 | /** |
||
32 | * Returns the image's intended purpose. |
||
33 | * |
||
34 | * @return string[] |
||
35 | */ |
||
36 | public function getPurpose() |
||
40 | |||
41 | /** |
||
42 | * Adds a purpose for this image. |
||
43 | * |
||
44 | * @param string $purpose One of of Image::PURPOSE_* constants. |
||
45 | * |
||
46 | * @return Image |
||
47 | * |
||
48 | * @see https://www.w3.org/TR/appmanifest/#purpose-member |
||
49 | */ |
||
50 | public function addPurpose($purpose) |
||
55 | |||
56 | /** |
||
57 | * Returns an array of sizes contained in this file. |
||
58 | * |
||
59 | * @return array[] |
||
60 | */ |
||
61 | public function getSizes() |
||
65 | |||
66 | /** |
||
67 | * Adds an additional size contained in this file. |
||
68 | * |
||
69 | * @param int $width |
||
70 | * @param int $height |
||
71 | * |
||
72 | * @return Image |
||
73 | * |
||
74 | * @see https://www.w3.org/TR/appmanifest/#sizes-member |
||
75 | */ |
||
76 | public function addSize($width, $height) |
||
81 | |||
82 | /** |
||
83 | * Returns the source path of this file. |
||
84 | * |
||
85 | * @return string|null |
||
86 | */ |
||
87 | public function getSrc() |
||
91 | |||
92 | /** |
||
93 | * Sets the source path of this file. |
||
94 | * |
||
95 | * @param string|null $src |
||
96 | * |
||
97 | * @return Image |
||
98 | * |
||
99 | * @see https://www.w3.org/TR/appmanifest/#src-member |
||
100 | */ |
||
101 | public function setSrc($src) |
||
106 | |||
107 | /** |
||
108 | * Returns the MIME type of this file. |
||
109 | * |
||
110 | * @return string|null |
||
111 | */ |
||
112 | public function getType() |
||
116 | |||
117 | /** |
||
118 | * Sets the MIME type of this file. |
||
119 | * |
||
120 | * @param string $type |
||
121 | * |
||
122 | * @return Image |
||
123 | * |
||
124 | * @see https://www.w3.org/TR/appmanifest/#type-member |
||
125 | */ |
||
126 | public function setType($type) |
||
131 | } |
||
132 |