1 | <?php |
||
24 | class ImageSet implements ImageSetInterface |
||
25 | { |
||
26 | use EntityTrait; |
||
27 | |||
28 | /** |
||
29 | * The id of this image set. |
||
30 | * |
||
31 | * @ODM\Field(type="string") |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $id; |
||
35 | |||
36 | /** |
||
37 | * Images in this set. |
||
38 | * |
||
39 | * @ODM\ReferenceMany(discriminatorField="_entity", cascade="all", orphanRemoval=true) |
||
40 | * @var Collection |
||
41 | */ |
||
42 | protected $images; |
||
43 | |||
44 | /** |
||
45 | * @internal |
||
46 | * Creates a unique {@link $id} for this ImageSet |
||
47 | */ |
||
48 | public function __construct() |
||
52 | |||
53 | /** |
||
54 | * Provide convinient methods for get and set. |
||
55 | * |
||
56 | * - get<ImageKey> proxies to get(<imageKey>) |
||
57 | * - set<ImageKey>($image) proxies to set(<imageKey>, $image) |
||
58 | * |
||
59 | * @param string $method |
||
60 | * @param array $args |
||
61 | * |
||
62 | * @return $this|ImageInterface|null |
||
63 | * @throws \BadMethodCallException |
||
64 | */ |
||
65 | public function __call($method, $args) |
||
86 | |||
87 | /** |
||
88 | * Clear all the images in this set. |
||
89 | * |
||
90 | * @return self |
||
91 | */ |
||
92 | public function clear() |
||
100 | |||
101 | /** |
||
102 | * @param Collection $images |
||
103 | * |
||
104 | * @return self |
||
105 | */ |
||
106 | public function setImagesCollection(Collection $images) |
||
113 | |||
114 | /** |
||
115 | * Set images and permissions. |
||
116 | * |
||
117 | * Replaces the whole set! |
||
118 | * |
||
119 | * @param array $images |
||
120 | * @param PermissionsInterface $permissions |
||
|
|||
121 | * |
||
122 | * @return self |
||
123 | */ |
||
124 | public function setImages(array $images, PermissionsInterface $permissions = null) |
||
138 | |||
139 | /** |
||
140 | * @return ArrayCollection|Collection |
||
141 | */ |
||
142 | protected function getImages() |
||
150 | |||
151 | /** |
||
152 | * Get an image |
||
153 | * |
||
154 | * If no image with the $key is found, the image with the key |
||
155 | * self::ORIGINAL is returned. Unless self::ORIGINAL is requested, |
||
156 | * in that case NULL is returned. |
||
157 | * |
||
158 | * @param string $key |
||
159 | * |
||
160 | * @return ImageInterface|null |
||
161 | */ |
||
162 | public function get($key) |
||
173 | |||
174 | /** |
||
175 | * Set an image. |
||
176 | * |
||
177 | * Replaces any image with the same $key, unless $check is false. |
||
178 | * |
||
179 | * @param string $key |
||
180 | * @param ImageInterface $image |
||
181 | * @param bool $check |
||
182 | * |
||
183 | * @return self |
||
184 | */ |
||
185 | public function set($key, ImageInterface $image, $check = true) |
||
199 | |||
200 | /** |
||
201 | * Set permissions for all images in this set. |
||
202 | * |
||
203 | * @param PermissionsInterface $permissions |
||
204 | * |
||
205 | * @return self |
||
206 | */ |
||
207 | public function setPermissions(PermissionsInterface $permissions) |
||
219 | } |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.