Test Failed
Pull Request — master (#31)
by Filippo
10:49 queued 07:49
created

MergeFilesystem::disk()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
cc 3
eloc 3
nc 2
nop 1
dl 0
loc 7
rs 10
c 2
b 1
f 0
1
<?php
2
3
namespace Jobtech\LaravelChunky\Support;
4
5
use Jobtech\LaravelChunky\Events\MergeAdded;
6
7
class MergeFilesystem extends Filesystem
8
{
9
    /**
10
     * Write the origin stream into destination.
11
     *
12
     * @param string $destination
13
     * @param resource|null $origin
14
     * @param array $options
15
     *
16
     * @throws \Illuminate\Contracts\Filesystem\FileExistsException
17
     *
18
     * @return string
19
     */
20
    public function store(string $destination, $origin, $options = []): string
21
    {
22
        $destination = $this->path($destination);
23
        if (is_resource($origin)) {
24
            $origin = stream_get_contents($origin);
25
        }
26
27
        if ($this->filesystem()->disk($this->disk)->put($destination, $origin, $options)) {
28
            event(new MergeAdded($destination));
0 ignored issues
show
Bug introduced by
The function event was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

28
            /** @scrutinizer ignore-call */ 
29
            event(new MergeAdded($destination));
Loading history...
29
30
            return $destination;
31
        }
32
33
        return false;
0 ignored issues
show
Bug Best Practice introduced by
The expression return false returns the type false which is incompatible with the type-hinted return string.
Loading history...
34
    }
35
}
36