Completed
Branch v7 (f01542)
by Pascal
08:46
created

MediaCollection::make()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Pbmedia\LaravelFFMpeg\Filesystem;
4
5
use Illuminate\Support\Collection;
6
use Illuminate\Support\Traits\ForwardsCalls;
7
8
/**
9
 * Mostly a wrapper around the Collection class.
10
 */
11
class MediaCollection
12
{
13
    use ForwardsCalls;
14
15
    private Collection $items;
16
17
    public function __construct(array $items = [])
18
    {
19
        $this->items = new Collection($items);
20
    }
21
22
    public static function make(array $items = []): self
23
    {
24
        return new static($items);
25
    }
26
27
    public function getLocalPaths(): array
28
    {
29
        return $this->items->map->getLocalPath()->all();
30
    }
31
32
    public function collection(): Collection
33
    {
34
        return $this->items;
35
    }
36
37
    public function __call($method, $parameters)
38
    {
39
        return $this->forwardCallTo($this->collection(), $method, $parameters);
40
    }
41
}
42