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

File   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 32
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getDisk() 0 4 1
A getPath() 0 4 1
A getFullPath() 0 4 1
A createFromTempPath() 0 4 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