Passed
Push — master ( e83d3e...f8b104 )
by alpha
02:24
created

AliyunOssAdapterTrait::rename()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 6
1
<?php
2
3
namespace AlphaSnow\AliyunOss;
4
5
use League\Flysystem\AdapterInterface;
6
use League\Flysystem\Config;
7
use League\Flysystem\Util;
8
use OSS\Core\OssException;
9
use OSS\OssClient;
10
11
trait AliyunOssAdapterTrait
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16 2 View Code Duplication
    public function write($path, $contents, Config $config)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
17
    {
18 2
        $object = $this->applyPathPrefix($path);
0 ignored issues
show
Bug introduced by
It seems like applyPathPrefix() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
19 2
        $options = $this->getOptions([], $config);
0 ignored issues
show
Bug introduced by
It seems like getOptions() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
20
21 2
        if (!isset($options[OssClient::OSS_LENGTH])) {
22 2
            $options[OssClient::OSS_LENGTH] = Util::contentSize($contents);
23
        }
24 2
        if (!isset($options[OssClient::OSS_CONTENT_TYPE])) {
25 2
            $options[OssClient::OSS_CONTENT_TYPE] = Util::guessMimeType($path, $contents);
26
        }
27
28
        try {
29
            // https://help.aliyun.com/document_detail/31978.html
30 2
            $this->client->putObject($this->bucket, $object, $contents, $options);
0 ignored issues
show
Bug introduced by
The property client does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
Bug introduced by
The property bucket does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
31
        } catch (OssException $e) {
32
            $this->logErr(__FUNCTION__, $e);
0 ignored issues
show
Bug introduced by
It seems like logErr() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
33
            return false;
34
        }
35
36 2
        return $this->normalizeResponse($options, $path);
0 ignored issues
show
Bug introduced by
It seems like normalizeResponse() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42 2
    public function writeStream($path, $resource, Config $config)
43
    {
44 2
        $object = $this->applyPathPrefix($path);
0 ignored issues
show
Bug introduced by
It seems like applyPathPrefix() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
45 2
        $options = $this->getOptions([], $config);
0 ignored issues
show
Bug introduced by
It seems like getOptions() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
46
47
        try {
48
            // https://help.aliyun.com/document_detail/31959.html
49 2
            $this->client->uploadStream($this->bucket, $object, $resource, $options);
50
        } catch (OssException $e) {
51
            $this->logErr(__FUNCTION__, $e);
0 ignored issues
show
Bug introduced by
It seems like logErr() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
52
            return false;
53
        }
54
55 2
        return $this->normalizeResponse($options, $path);
0 ignored issues
show
Bug introduced by
It seems like normalizeResponse() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
56
    }
57
58
    /**
59
     * {@inheritdoc}
60
     */
61 1 View Code Duplication
    public function writeFile($path, $filePath, Config $config)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
62
    {
63 1
        $object = $this->applyPathPrefix($path);
0 ignored issues
show
Bug introduced by
It seems like applyPathPrefix() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
64 1
        $options = $this->getOptions([], $config);
0 ignored issues
show
Bug introduced by
It seems like getOptions() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
65
66 1
        if (!isset($options[OssClient::OSS_CONTENT_TYPE])) {
67 1
            $options[OssClient::OSS_CHECK_MD5] = true;
68
        }
69 1
        if (!isset($options[OssClient::OSS_CONTENT_TYPE])) {
70 1
            $options[OssClient::OSS_CONTENT_TYPE] = Util::guessMimeType($path, '');
71
        }
72
73
        try {
74 1
            $this->client->uploadFile($this->bucket, $object, $filePath, $options);
75
        } catch (OssException $e) {
76
            $this->logErr(__FUNCTION__, $e);
0 ignored issues
show
Bug introduced by
It seems like logErr() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
77
            return false;
78
        }
79
80 1
        return $this->normalizeResponse($options, $path);
0 ignored issues
show
Bug introduced by
It seems like normalizeResponse() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
81
    }
82
83
    /**
84
     * {@inheritdoc}
85
     */
86 View Code Duplication
    public function update($path, $contents, Config $config)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
87
    {
88
        if (!$config->has('visibility') && !$config->has('ACL')) {
89
            // 新文件未配置权限情况下,继承旧文件权限
90
            $config->set(AliyunOssUtil::$metaMap['ACL'], $this->getObjectACL($path));
0 ignored issues
show
Bug introduced by
It seems like getObjectACL() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
91
        }
92
        // 允许覆盖同名文件
93
        $config->set('x-oss-forbid-overwrite', 'false');
94
95
        return $this->write($path, $contents, $config);
96
    }
97
98
    /**
99
     * {@inheritdoc}
100
     */
101 View Code Duplication
    public function updateStream($path, $resource, Config $config)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
102
    {
103
        if (!$config->has('visibility') && !$config->has('ACL')) {
104
            // 新文件未配置权限情况下,继承旧文件权限
105
            $config->set(AliyunOssUtil::$metaMap['ACL'], $this->getObjectACL($path));
0 ignored issues
show
Bug introduced by
It seems like getObjectACL() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
106
        }
107
        // 允许覆盖同名文件
108
        $config->set('x-oss-forbid-overwrite', 'false');
109
110
        return $this->writeStream($path, $resource, $config);
111
    }
112
113
    /**
114
     * {@inheritdoc}
115
     */
116
    public function rename($path, $newpath)
117
    {
118
        if (!$this->copy($path, $newpath)) {
119
            return false;
120
        }
121
122
        return $this->delete($path);
123
    }
124
125
    /**
126
     * {@inheritdoc}
127
     */
128 View Code Duplication
    public function copy($path, $newpath)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
129
    {
130
        $object = $this->applyPathPrefix($path);
0 ignored issues
show
Bug introduced by
It seems like applyPathPrefix() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
131
        $newObject = $this->applyPathPrefix($newpath);
0 ignored issues
show
Bug introduced by
It seems like applyPathPrefix() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
132
133
        try {
134
            $this->client->copyObject($this->bucket, $object, $this->bucket, $newObject);
135
        } catch (OssException $e) {
136
            $this->logErr(__FUNCTION__, $e);
0 ignored issues
show
Bug introduced by
It seems like logErr() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
137
            return false;
138
        }
139
140
        return true;
141
    }
142
143
    /**
144
     * {@inheritdoc}
145
     */
146 View Code Duplication
    public function delete($path)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
147
    {
148
        $bucket = $this->bucket;
149
        $object = $this->applyPathPrefix($path);
0 ignored issues
show
Bug introduced by
It seems like applyPathPrefix() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
150
151
        try {
152
            $this->client->deleteObject($bucket, $object);
153
        } catch (OssException $e) {
154
            $this->logErr(__FUNCTION__, $e);
0 ignored issues
show
Bug introduced by
It seems like logErr() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
155
            return false;
156
        }
157
158
        return !$this->has($path);
0 ignored issues
show
Bug introduced by
It seems like has() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
159
    }
160
161
    /**
162
     * {@inheritdoc}
163
     */
164
    public function deleteDir($dirname)
165
    {
166
        $dirname = rtrim($this->applyPathPrefix($dirname), '/') . '/';
0 ignored issues
show
Bug introduced by
It seems like applyPathPrefix() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
167
        $dirObjects = $this->listDirObjects($dirname, true);
0 ignored issues
show
Bug introduced by
It seems like listDirObjects() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
168
169
        if (count($dirObjects['objects']) > 0) {
170
            $objects = [];
171
            foreach ($dirObjects['objects'] as $object) {
172
                $objects[] = $object['Key'];
173
            }
174
175
            try {
176
                $this->client->deleteObjects($this->bucket, $objects);
177
            } catch (OssException $e) {
178
                $this->logErr(__FUNCTION__, $e);
0 ignored issues
show
Bug introduced by
It seems like logErr() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
179
                return false;
180
            }
181
        }
182
183
        try {
184
            $this->client->deleteObject($this->bucket, $dirname);
185
        } catch (OssException $e) {
186
            $this->logErr(__FUNCTION__, $e);
0 ignored issues
show
Bug introduced by
It seems like logErr() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
187
            return false;
188
        }
189
190
        return true;
191
    }
192
193
    /**
194
     * {@inheritdoc}
195
     */
196
    public function createDir($dirname, Config $config)
197
    {
198
        $object = $this->applyPathPrefix($dirname);
0 ignored issues
show
Bug introduced by
It seems like applyPathPrefix() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
199
        $options = $this->getOptionsFromConfig($config);
0 ignored issues
show
Bug introduced by
It seems like getOptionsFromConfig() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
200
201
        try {
202
            $this->client->createObjectDir($this->bucket, $object, $options);
203
        } catch (OssException $e) {
204
            $this->logErr(__FUNCTION__, $e);
0 ignored issues
show
Bug introduced by
It seems like logErr() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
205
            return false;
206
        }
207
208
        return ['path' => $dirname, 'type' => 'dir'];
209
    }
210
211
    /**
212
     * {@inheritdoc}
213
     */
214
    public function setVisibility($path, $visibility)
215
    {
216
        $object = $this->applyPathPrefix($path);
0 ignored issues
show
Bug introduced by
It seems like applyPathPrefix() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
217
        $acl = ($visibility === AdapterInterface::VISIBILITY_PUBLIC) ? OssClient::OSS_ACL_TYPE_PUBLIC_READ : OssClient::OSS_ACL_TYPE_PRIVATE;
218
219
        $this->client->putObjectAcl($this->bucket, $object, $acl);
220
221
        return compact('visibility');
222
    }
223
}
224