1 | <?php |
||
18 | final class SettingsService extends AbstractService |
||
19 | { |
||
20 | /** |
||
21 | * @var SettingsRepository |
||
22 | */ |
||
23 | private $repository; |
||
24 | |||
25 | /** |
||
26 | * @var FileUploader |
||
27 | */ |
||
28 | private $fileUploader; |
||
29 | |||
30 | public function __construct( |
||
40 | |||
41 | /** |
||
42 | * Update settings in database. |
||
43 | */ |
||
44 | public function updateSettings(array $formData): void |
||
49 | |||
50 | /** |
||
51 | * Upload custom header image. |
||
52 | * |
||
53 | * @param string $type |
||
54 | * @param Request $request |
||
55 | * |
||
56 | * @return Response |
||
57 | * @throws \Exception |
||
58 | */ |
||
59 | public function uploadImage(string $type = 'header_image', Request $request): Response |
||
73 | |||
74 | /** |
||
75 | * Validate header image. |
||
76 | */ |
||
77 | private function isImageValid(UploadedFile $uploadedFile): bool |
||
91 | |||
92 | /** |
||
93 | * Reset a header image to the default image. |
||
94 | * |
||
95 | * @param string $type |
||
96 | * @param Request $request |
||
97 | */ |
||
98 | public function resetImage(string $type = 'header_image', Request $request): void |
||
112 | |||
113 | /** |
||
114 | * Delete header image. |
||
115 | * |
||
116 | * @param string $filename |
||
117 | * @param string $type |
||
118 | */ |
||
119 | private function deleteImage(string $filename, string $type = 'header_image'): void |
||
128 | } |
||
129 |
This check looks at variables that are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.