1 | <?php |
||
23 | class DataManager |
||
24 | { |
||
25 | /** |
||
26 | * @var MimeTypeGuesserInterface |
||
27 | */ |
||
28 | protected $mimeTypeGuesser; |
||
29 | |||
30 | /** |
||
31 | * @var DeprecatedExtensionGuesserInterface|MimeTypesInterface |
||
32 | */ |
||
33 | protected $extensionGuesser; |
||
34 | |||
35 | /** |
||
36 | * @var FilterConfiguration |
||
37 | */ |
||
38 | protected $filterConfig; |
||
39 | |||
40 | /** |
||
41 | * @var string|null |
||
42 | */ |
||
43 | protected $defaultLoader; |
||
44 | |||
45 | /** |
||
46 | * @var string|null |
||
47 | */ |
||
48 | protected $globalDefaultImage; |
||
49 | |||
50 | /** |
||
51 | * @var LoaderInterface[] |
||
52 | */ |
||
53 | protected $loaders = []; |
||
54 | |||
55 | /** |
||
56 | * @param MimeTypeGuesserInterface $mimeTypeGuesser |
||
57 | * @param DeprecatedExtensionGuesserInterface|MimeTypesInterface $extensionGuesser |
||
58 | * @param FilterConfiguration $filterConfig |
||
59 | * @param string $defaultLoader |
||
60 | * @param string $globalDefaultImage |
||
61 | */ |
||
62 | public function __construct( |
||
83 | |||
84 | /** |
||
85 | * Adds a loader to retrieve images for the given filter. |
||
86 | * |
||
87 | * @param string $filter |
||
88 | * @param LoaderInterface $loader |
||
89 | */ |
||
90 | public function addLoader($filter, LoaderInterface $loader) |
||
94 | |||
95 | /** |
||
96 | * Returns a loader previously attached to the given filter. |
||
97 | * |
||
98 | * @param string $filter |
||
99 | * |
||
100 | * @throws \InvalidArgumentException |
||
101 | * |
||
102 | * @return LoaderInterface |
||
103 | */ |
||
104 | public function getLoader($filter) |
||
120 | |||
121 | /** |
||
122 | * Retrieves an image with the given filter applied. |
||
123 | * |
||
124 | * @param string $filter |
||
125 | * @param string $path |
||
126 | * |
||
127 | * @throws \LogicException |
||
128 | * |
||
129 | * @return BinaryInterface |
||
130 | */ |
||
131 | public function find($filter, $path) |
||
157 | |||
158 | /** |
||
159 | * Get default image url with the given filter applied. |
||
160 | * |
||
161 | * @param string $filter |
||
162 | * |
||
163 | * @return string|null |
||
164 | */ |
||
165 | public function getDefaultImageUrl($filter) |
||
178 | |||
179 | private function getExtension(?string $mimeType): ?string |
||
191 | } |
||
192 |
If you suppress an error, we recommend checking for the error condition explicitly: