StreamToFile   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 2
Bugs 1 Features 2
Metric Value
eloc 7
dl 0
loc 39
rs 10
c 2
b 1
f 2
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getPath() 0 3 1
A getParams() 0 3 1
A getFilter() 0 3 1
A setParams() 0 4 1
1
<?php
2
3
/**
4
 * This file is part of the PHP-FFmpeg-video-streaming package.
5
 *
6
 * (c) Amin Yazdanpanah <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
13
namespace Streaming;
14
15
16
use Streaming\Filters\StreamFilterInterface;
17
use Streaming\Filters\StreamToFileFilter;
18
19
class StreamToFile extends Stream
20
{
21
    /**
22
     * @var array
23
     */
24
    private $params = [];
25
26
    /**
27
     * @param array $params
28
     * @return StreamToFile
29
     */
30
    public function setParams(array $params): StreamToFile
31
    {
32
        $this->params = $params;
33
        return $this;
34
    }
35
36
    /**
37
     * @return array
38
     */
39
    public function getParams(): array
40
    {
41
        return $this->params;
42
    }
43
44
    /**
45
     * @return string
46
     */
47
    protected function getPath(): string
48
    {
49
        return implode(".", [$this->getFilePath(), $this->pathInfo(PATHINFO_EXTENSION) ?? "mp4"]);
50
    }
51
52
    /**
53
     * @return StreamToFileFilter
54
     */
55
    protected function getFilter(): StreamFilterInterface
56
    {
57
        return new StreamToFileFilter($this);
58
    }
59
}