Total Complexity | 9 |
Total Lines | 89 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
20 | class Media |
||
21 | { |
||
22 | |||
23 | protected $media; |
||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | private $path; |
||
28 | /** |
||
29 | * @var bool |
||
30 | */ |
||
31 | private $is_tmp; |
||
32 | |||
33 | /** |
||
34 | * Media constructor. |
||
35 | * @param MediaTypeInterface $media |
||
36 | * @param string $path |
||
37 | * @param bool $is_tmp |
||
38 | */ |
||
39 | public function __construct(MediaTypeInterface $media, string $path, bool $is_tmp) |
||
40 | { |
||
41 | $this->media = $media; |
||
42 | $this->path = $path; |
||
43 | $this->is_tmp = $is_tmp; |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * @return DASH |
||
48 | */ |
||
49 | public function DASH(): DASH |
||
50 | { |
||
51 | return new DASH($this); |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * @return HLS |
||
56 | */ |
||
57 | public function HLS(): HLS |
||
58 | { |
||
59 | return new HLS($this); |
||
60 | } |
||
61 | |||
62 | |||
63 | /** |
||
64 | * @return array |
||
65 | */ |
||
66 | public function probe(): array |
||
67 | { |
||
68 | return[ |
||
69 | 'format' => $this->getFormat(), |
||
|
|||
70 | 'streams' => $this->getStreams() |
||
71 | ]; |
||
72 | } |
||
73 | |||
74 | /** |
||
75 | * @param $argument |
||
76 | * @return Media |
||
77 | */ |
||
78 | protected function isInstanceofArgument($argument) |
||
79 | { |
||
80 | return ($argument instanceof $this->media) ? $this : $argument; |
||
81 | } |
||
82 | |||
83 | /** |
||
84 | * @param $method |
||
85 | * @param $parameters |
||
86 | * @return Media |
||
87 | */ |
||
88 | public function __call($method, $parameters) |
||
89 | { |
||
90 | return $this->isInstanceofArgument( |
||
91 | call_user_func_array([$this->media, $method], $parameters) |
||
92 | ); |
||
93 | } |
||
94 | |||
95 | /** |
||
96 | * @return string |
||
97 | */ |
||
98 | public function getPath(): string |
||
101 | } |
||
102 | |||
103 | /** |
||
104 | * @return bool |
||
105 | */ |
||
106 | public function isTmp(): bool |
||
109 | } |
||
110 | } |
||
111 |