1 | <?php |
||
22 | class DataManager |
||
23 | { |
||
24 | /** |
||
25 | * @var FileAttributesApplier |
||
26 | */ |
||
27 | protected $fileAttributes; |
||
28 | |||
29 | /** |
||
30 | * @var FilterConfiguration |
||
31 | */ |
||
32 | protected $filterConfig; |
||
33 | |||
34 | /** |
||
35 | * @var string|null |
||
36 | */ |
||
37 | protected $defaultLoader; |
||
38 | |||
39 | /** |
||
40 | * @var string|null |
||
41 | */ |
||
42 | protected $globalDefaultImage; |
||
43 | |||
44 | /** |
||
45 | * @var LoaderInterface[] |
||
46 | */ |
||
47 | protected $loaders = []; |
||
48 | |||
49 | /** |
||
50 | * @param FilterConfiguration $filterConfig |
||
51 | * @param FileAttributesApplier $fileAttributesApplier |
||
52 | * @param string $defaultLoader |
||
53 | * @param string $globalDefaultImage |
||
54 | */ |
||
55 | public function __construct( |
||
66 | |||
67 | /** |
||
68 | * Adds a loader to retrieve images for the given filter. |
||
69 | * |
||
70 | * @param string $filter |
||
71 | * @param LoaderInterface $loader |
||
72 | */ |
||
73 | public function addLoader(string $filter, LoaderInterface $loader): void |
||
77 | |||
78 | /** |
||
79 | * Returns a loader previously attached to the given filter. |
||
80 | * |
||
81 | * @param string $filter |
||
82 | * |
||
83 | * @throws \InvalidArgumentException |
||
84 | * |
||
85 | * @return LoaderInterface |
||
86 | */ |
||
87 | public function getLoader(string $filter): LoaderInterface |
||
101 | |||
102 | /** |
||
103 | * Retrieves an image with the given filter applied. |
||
104 | * |
||
105 | * @param string $filter |
||
106 | * @param string $path |
||
107 | * |
||
108 | * @throws \LogicException |
||
109 | * |
||
110 | * @return FileInterface |
||
111 | */ |
||
112 | public function find(string $filter, string $path): FileInterface |
||
131 | |||
132 | /** |
||
133 | * Get default image url with the given filter applied. |
||
134 | * |
||
135 | * @param string $filter |
||
136 | * |
||
137 | * @return string|null |
||
138 | */ |
||
139 | public function getDefaultImageUrl(string $filter): ?string |
||
155 | } |
||
156 |