Passed
Push — master ( 67f2c8...68e9c9 )
by Amin
01:53
created

HLS::getHlsKeyInfoFile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Copyright 2019 Amin Yazdanpanah<http://www.aminyazdanpanah.com>.
5
 *
6
 * Licensed under the MIT License;
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 *      https://opensource.org/licenses/MIT
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 */
18
19
namespace AYazdanpanah\FFMpegStreaming;
20
21
use AYazdanpanah\FFMpegStreaming\Filters\HLSFilter;
22
use AYazdanpanah\FFMpegStreaming\Traits\Representation;
0 ignored issues
show
Bug introduced by
This use statement conflicts with another class in this namespace, AYazdanpanah\FFMpegStreaming\Representation. Consider defining an alias.

Let?s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let?s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/Foo.php are loaded in the same runtime, you will see a PHP error such as the following:

PHP Fatal error:  Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php

However, as OtherDir/Foo.php does not necessarily have to be loaded and the error is only triggered if it is loaded before OtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
23
use AYazdanpanah\FFMpegStreaming\Filters\Filter;
24
25
class HLS extends Export
26
{
27
    use Representation;
28
29
    /** @var string */
30
    private $hls_time = 5;
31
32
    /** @var bool */
33
    private $hls_allow_cache = true;
34
35
    /** @var string */
36
    private $hls_key_info_file = "";
37
38
    /**
39
     * @param string $hls_time
40
     * @return HLS
41
     */
42
    public function setHlsTime(string $hls_time): HLS
43
    {
44
        $this->hls_time = $hls_time;
45
        return $this;
46
    }
47
48
    /**
49
     * @return string
50
     */
51
    public function getHlsTime(): string
52
    {
53
        return $this->hls_time;
54
    }
55
56
    /**
57
     * @param bool $hls_allow_cache
58
     * @return HLS
59
     */
60
    public function setHlsAllowCache(bool $hls_allow_cache): HLS
61
    {
62
        $this->hls_allow_cache = $hls_allow_cache;
63
        return $this;
64
    }
65
66
    /**
67
     * @return bool
68
     */
69
    public function isHlsAllowCache(): bool
70
    {
71
        return $this->hls_allow_cache;
72
    }
73
74
    /**
75
     * @param string $hls_key_info_file
76
     * @return HLS
77
     */
78
    public function setHlsKeyInfoFile(string $hls_key_info_file): HLS
79
    {
80
        $this->hls_key_info_file = $hls_key_info_file;
81
        return $this;
82
    }
83
84
    /**
85
     * @return string
86
     */
87
    public function getHlsKeyInfoFile(): string
88
    {
89
        return $this->hls_key_info_file;
90
    }
91
92
    /**
93
     * @return Filter
94
     */
95
    protected function getFilter(): Filter
96
    {
97
        return $this->filter;
98
    }
99
100
    /**
101
     * @return mixed|void
102
     */
103
    protected function setFilter()
104
    {
105
        $this->filter = new HLSFilter($this);
106
    }
107
}
108