Completed
Push — master ( 3ee920...44cf32 )
by Pascal
02:41
created

File::createFromTempPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Pbmedia\LaravelFFMpeg;
4
5
class File
6
{
7
    protected $disk;
8
9
    protected $path;
10
11
    public function __construct(Disk $disk, string $path)
12
    {
13
        $this->disk = $disk;
14
        $this->path = $path;
15
    }
16
17
    public function getDisk(): Disk
18
    {
19
        return $this->disk;
20
    }
21
22
    public function getPath(): string
23
    {
24
        return $this->path;
25
    }
26
27
    public function getFullPath(): string
28
    {
29
        return $this->getDisk()->getPath() . $this->getPath();
30
    }
31
32
    public function createFromTempPath(string $path): bool
33
    {
34
        return $this->getDisk()->move($path, $this->getPath());
0 ignored issues
show
Documentation Bug introduced by
The method move does not exist on object<Pbmedia\LaravelFFMpeg\Disk>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
35
    }
36
}
37