Total Complexity | 8 |
Total Lines | 71 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
22 | class Media |
||
23 | { |
||
24 | |||
25 | protected $media; |
||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | private $path; |
||
30 | |||
31 | /** |
||
32 | * Media constructor. |
||
33 | * @param MediaTypeInterface $media |
||
34 | * @param string $path |
||
35 | */ |
||
36 | public function __construct(MediaTypeInterface $media, string $path) |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * @return DASH |
||
44 | */ |
||
45 | public function DASH(): DASH |
||
46 | { |
||
47 | return new DASH($this); |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * @return HLS |
||
52 | */ |
||
53 | public function HLS(): HLS |
||
54 | { |
||
55 | return new HLS($this); |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * @param $argument |
||
60 | * @return Media |
||
61 | */ |
||
62 | protected function isInstanceofArgument($argument) |
||
63 | { |
||
64 | return ($argument instanceof $this->media) ? $this : $argument; |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * @param $method |
||
69 | * @param $parameters |
||
70 | * @return Media |
||
71 | */ |
||
72 | public function __call($method, $parameters) |
||
73 | { |
||
74 | return $this->isInstanceofArgument( |
||
75 | call_user_func_array([$this->media, $method], $parameters) |
||
76 | ); |
||
77 | } |
||
78 | |||
79 | /** |
||
80 | * @return mixed |
||
81 | */ |
||
82 | public function getFirstStream(): Stream |
||
83 | { |
||
84 | return $this->media->getStreams()->first(); |
||
|
|||
85 | } |
||
86 | |||
87 | /** |
||
88 | * @return array |
||
89 | */ |
||
90 | public function getPathInfo(): array |
||
93 | } |
||
94 | } |
||
95 |