Conditions | 3 |
Paths | 3 |
Total Lines | 24 |
Code Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
29 | public function upload(AbstractFactory $factory, array $data, File $file, string $field = 'filePath'): FileInterface |
||
30 | { |
||
31 | $entity = $factory->create($data); |
||
32 | if (!($entity instanceof FileInterface)) { |
||
33 | throw new \Exception('Invalid entity returned from FixtureFileUploader::upload factory'); |
||
34 | } |
||
35 | $tempFile = tmpfile(); |
||
36 | if (false === $tempFile) { |
||
37 | throw new \Exception('Could not create temporary file'); |
||
38 | } |
||
39 | $tempPath = stream_get_meta_data($tempFile)['uri']; |
||
40 | fclose($tempFile); |
||
41 | |||
42 | $fs = new Filesystem(); |
||
43 | $fs->copy($file->getRealPath(), $tempPath, true); |
||
44 | $uploadedFile = new UploadedFile( |
||
45 | $tempPath, |
||
46 | $file->getFilename(), |
||
47 | $file->getMimeType(), |
||
48 | null, |
||
49 | true |
||
50 | ); |
||
51 | $this->fileUploader->upload($entity, $field, $uploadedFile); |
||
52 | return $entity; |
||
53 | } |
||
55 |
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