| 1 | <?php |
||
| 2 | |||
| 3 | namespace Freyo\Flysystem\QcloudCOSv5\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 string|false |
||
| 27 | */ |
||
| 28 | public function handle($path, $remoteUrl, array $options = []) |
||
| 29 | { |
||
| 30 | //Get file from remote url |
||
| 31 | $contents = $this->filesystem |
||
| 32 | ->getAdapter() |
||
| 33 | ->getHttpClient() |
||
| 34 | ->get($remoteUrl) |
||
| 35 | ->getBody() |
||
| 36 | ->getContents(); |
||
| 37 | |||
| 38 | $filename = md5($contents); |
||
| 39 | $extension = ExtensionGuesser::getInstance()->guess(MimeType::detectByContent($contents)); |
||
| 40 | $name = $filename.'.'.$extension; |
||
| 41 | |||
| 42 | $path = trim($path.'/'.$name, '/'); |
||
| 43 | |||
| 44 | return $this->filesystem->put($path, $contents, $options) ? $path : false; |
||
| 45 | } |
||
| 46 | } |
||
| 47 |
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