| Conditions | 3 |
| Paths | 12 |
| Total Lines | 23 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | public function __invoke(Request $request): Response |
||
| 24 | { |
||
| 25 | |||
| 26 | try { |
||
| 27 | $file = $request->files->get('file'); |
||
| 28 | |||
| 29 | if (!$file) { |
||
| 30 | throw new BadRequestHttpException('No file provided'); |
||
| 31 | } |
||
| 32 | |||
| 33 | $content = file_get_contents($file->getPathname()); |
||
| 34 | $fileType = $file->getClientMimeType(); |
||
| 35 | $originalFilename = $file->getClientOriginalName(); |
||
| 36 | |||
| 37 | $fileEntity = new File(); |
||
| 38 | $fileEntity->setContent($content); |
||
| 39 | $fileEntity->setFileType($fileType); |
||
| 40 | |||
| 41 | $this->em->persist($fileEntity); |
||
| 42 | $this->em->flush(); |
||
| 43 | return new JsonResponse($this->hydratorService->item(File::class, $fileEntity->getId(), 'file_read')); |
||
| 44 | } catch (Exception $e) { |
||
| 45 | return new JsonResponse($this->hydratorService->error($e)); |
||
| 46 | } |
||
| 49 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths