1 | <?php |
||
22 | class DataManager |
||
23 | { |
||
24 | /** |
||
25 | * @var MimeTypeGuesserInterface |
||
26 | */ |
||
27 | protected $mimeTypeGuesser; |
||
28 | |||
29 | /** |
||
30 | * @var DeprecatedExtensionGuesserInterface|MimeTypesInterface |
||
31 | */ |
||
32 | protected $extensionGuesser; |
||
33 | |||
34 | /** |
||
35 | * @var FilterConfiguration |
||
36 | */ |
||
37 | protected $filterConfig; |
||
38 | |||
39 | /** |
||
40 | * @var string|null |
||
41 | */ |
||
42 | protected $defaultLoader; |
||
43 | |||
44 | /** |
||
45 | * @var string|null |
||
46 | */ |
||
47 | protected $globalDefaultImage; |
||
48 | |||
49 | /** |
||
50 | * @var LoaderInterface[] |
||
51 | */ |
||
52 | protected $loaders = []; |
||
53 | |||
54 | /** |
||
55 | * @param MimeTypeGuesserInterface $mimeTypeGuesser |
||
56 | * @param DeprecatedExtensionGuesserInterface|MimeTypesInterface $extensionGuesser |
||
57 | * @param FilterConfiguration $filterConfig |
||
58 | * @param string $defaultLoader |
||
59 | * @param string $globalDefaultImage |
||
60 | */ |
||
61 | public function __construct( |
||
78 | |||
79 | /** |
||
80 | * Adds a loader to retrieve images for the given filter. |
||
81 | * |
||
82 | * @param string $filter |
||
83 | * @param LoaderInterface $loader |
||
84 | */ |
||
85 | public function addLoader($filter, LoaderInterface $loader) |
||
89 | |||
90 | /** |
||
91 | * Returns a loader previously attached to the given filter. |
||
92 | * |
||
93 | * @param string $filter |
||
94 | * |
||
95 | * @throws \InvalidArgumentException |
||
96 | * |
||
97 | * @return LoaderInterface |
||
98 | */ |
||
99 | public function getLoader($filter) |
||
115 | |||
116 | /** |
||
117 | * Retrieves an image with the given filter applied. |
||
118 | * |
||
119 | * @param string $filter |
||
120 | * @param string $path |
||
121 | * |
||
122 | * @throws \LogicException |
||
123 | * |
||
124 | * @return BinaryInterface |
||
125 | */ |
||
126 | public function find($filter, $path) |
||
152 | |||
153 | /** |
||
154 | * Get default image url with the given filter applied. |
||
155 | * |
||
156 | * @param string $filter |
||
157 | * |
||
158 | * @return string|null |
||
159 | */ |
||
160 | public function getDefaultImageUrl($filter) |
||
173 | |||
174 | private function getExtension(?string $mimeType): ?string |
||
186 | } |
||
187 |
If you suppress an error, we recommend checking for the error condition explicitly: