PutFile   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 6
c 2
b 0
f 1
dl 0
loc 20
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 7 2
A getMethod() 0 3 1
1
<?php
2
/**
3
 * Created by jacob.
4
 * User: jacob
5
 * Date: 16/5/20
6
 * Time: 下午8:31
7
 */
8
9
namespace Jacobcyl\AliOSS\Plugins;
10
11
use League\Flysystem\Config;
0 ignored issues
show
Bug introduced by
The type League\Flysystem\Config was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use League\Flysystem\Plugin\AbstractPlugin;
0 ignored issues
show
Bug introduced by
The type League\Flysystem\Plugin\AbstractPlugin was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
14
class PutFile extends AbstractPlugin
15
{
16
17
    /**
18
     * Get the method name.
19
     *
20
     * @return string
21
     */
22
    public function getMethod()
23
    {
24
        return 'putFile';
25
    }
26
27
    public function handle($path, $filePath, array $options = []){
28
        $config = new Config($options);
29
        if (method_exists($this->filesystem, 'getConfig')) {
30
            $config->setFallback($this->filesystem->getConfig());
31
        }
32
33
        return (bool)$this->filesystem->getAdapter()->writeFile($path, $filePath, $config);
34
    }
35
}
36