Passed
Push — master ( bcce02...697a72 )
by Amin
02:05
created

StreamToFile::setParams()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 1
Metric Value
cc 1
eloc 2
c 1
b 1
f 1
nc 1
nop 1
dl 0
loc 4
rs 10
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\Exception\InvalidArgumentException;
17
use Streaming\Filters\Filter;
18
use Streaming\Filters\StreamToFileFilter;
19
20
class StreamToFile extends Export
21
{
22
    /**
23
     * @var array
24
     */
25
    private $params = [];
26
27
    /**
28
     * @param array $params
29
     * @return StreamToFile
30
     */
31
    public function setParams(array $params): StreamToFile
32
    {
33
        $this->params = $params;
34
        return $this;
35
    }
36
37
    /**
38
     * @return array
39
     */
40
    public function getParams(): array
41
    {
42
        return $this->params;
43
    }
44
45
    /**
46
     * @return string
47
     */
48
    protected function getPath(): string
49
    {
50
        return implode(".", [$this->getFilePath(), $this->path_info["extension"] ?? "mp4"]);
51
    }
52
53
    /**
54
     * @return Filter
55
     */
56
    protected function getFilter(): Filter
57
    {
58
        if ($this->uri) {
59
            throw new InvalidArgumentException("It is not possible to live this file");
60
        }
61
62
        return new StreamToFileFilter($this);
63
    }
64
}