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