1 | <?php |
||
2 | |||
3 | namespace Freyo\Flysystem\QcloudCOSv4\Plugins; |
||
4 | |||
5 | use League\Flysystem\Plugin\AbstractPlugin; |
||
6 | use League\Flysystem\Util\MimeType; |
||
7 | use Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser; |
||
0 ignored issues
–
show
|
|||
8 | |||
9 | class PutRemoteFile extends AbstractPlugin |
||
10 | { |
||
11 | /** |
||
12 | * Get the method name. |
||
13 | * |
||
14 | * @return string |
||
15 | */ |
||
16 | public function getMethod() |
||
17 | { |
||
18 | return 'putRemoteFile'; |
||
19 | } |
||
20 | |||
21 | /** |
||
22 | * @param $path |
||
23 | * @param $remoteUrl |
||
24 | * @param array $options |
||
25 | * |
||
26 | * @return bool |
||
27 | */ |
||
28 | public function handle($path, $remoteUrl, array $options = []) |
||
29 | { |
||
30 | //Get file from remote url |
||
31 | $contents = (new \GuzzleHttp\Client(['verify' => false])) |
||
32 | ->request('get', $remoteUrl) |
||
33 | ->getBody() |
||
34 | ->getContents(); |
||
35 | |||
36 | $filename = md5($contents); |
||
37 | $extension = ExtensionGuesser::getInstance()->guess(MimeType::detectByContent($contents)); |
||
38 | $name = $filename.'.'.$extension; |
||
39 | |||
40 | $path = trim($path.'/'.$name, '/'); |
||
41 | |||
42 | return $this->filesystem->put($path, $contents, $options) ? $path : false; |
||
0 ignored issues
–
show
|
|||
43 | } |
||
44 | } |
||
45 |
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