1 | <?php |
||
24 | final class Image implements PlatformInterface |
||
25 | { |
||
26 | use PlatformTrait; |
||
27 | |||
28 | const PURPOSE_BADGE = "badge"; |
||
29 | const PURPOSE_ANY = "any"; |
||
30 | |||
31 | private $purpose = [ ]; |
||
32 | private $sizes = [ ]; |
||
33 | private $src; |
||
34 | private $type; |
||
35 | |||
36 | /** |
||
37 | * Returns the image's intended purpose. |
||
38 | * |
||
39 | * @return string[] |
||
40 | */ |
||
41 | public function getPurpose() |
||
45 | |||
46 | /** |
||
47 | * Adds a purpose for this image. |
||
48 | * |
||
49 | * @param string $purpose One of of Image::PURPOSE_* constants. |
||
50 | * |
||
51 | * @return Image |
||
52 | * |
||
53 | * @see https://www.w3.org/TR/appmanifest/#purpose-member |
||
54 | */ |
||
55 | public function addPurpose($purpose) |
||
60 | |||
61 | /** |
||
62 | * Returns an array of sizes contained in this file. |
||
63 | * |
||
64 | * @return array[] |
||
65 | */ |
||
66 | 1 | public function getSizes() |
|
70 | |||
71 | /** |
||
72 | * Adds an additional size contained in this file. |
||
73 | * |
||
74 | * @param int $width |
||
75 | * @param int $height |
||
76 | * |
||
77 | * @return Image |
||
78 | * |
||
79 | * @see https://www.w3.org/TR/appmanifest/#sizes-member |
||
80 | */ |
||
81 | 1 | public function addSize($width, $height) |
|
86 | |||
87 | /** |
||
88 | * Returns the source path of this file. |
||
89 | * |
||
90 | * @return string|null |
||
91 | */ |
||
92 | 1 | public function getSrc() |
|
96 | |||
97 | /** |
||
98 | * Sets the source path of this file. |
||
99 | * |
||
100 | * @param string $src |
||
101 | * |
||
102 | * @return Image |
||
103 | * |
||
104 | * @see https://www.w3.org/TR/appmanifest/#src-member |
||
105 | */ |
||
106 | 1 | public function setSrc($src) |
|
111 | |||
112 | /** |
||
113 | * Returns the MIME type of this file. |
||
114 | * |
||
115 | * @return string|null |
||
116 | */ |
||
117 | 1 | public function getType() |
|
121 | |||
122 | /** |
||
123 | * Sets the MIME type of this file. |
||
124 | * |
||
125 | * @param string $type |
||
126 | * |
||
127 | * @return Image |
||
128 | * |
||
129 | * @see https://www.w3.org/TR/appmanifest/#type-member |
||
130 | */ |
||
131 | 1 | public function setType($type) |
|
136 | } |
||
137 |