MergeFilesystem::store()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
c 1
b 0
f 0
nc 2
nop 3
dl 0
loc 11
rs 10
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
24
        if ($this->filesystem()->disk($this->disk)->writeStream($destination, $origin, $options)) {
25
            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

25
            /** @scrutinizer ignore-call */ 
26
            event(new MergeAdded($destination));
Loading history...
26
27
            return $destination;
28
        }
29
30
        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...
31
    }
32
}
33