Completed
Pull Request — develop (#30)
by
unknown
02:43
created

ProgramDateTimeTag::dump()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 4
loc 4
ccs 2
cts 2
cp 1
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
/*
4
 * This file is part of the PhpM3u8 package.
5
 *
6
 * (c) Chrisyue <http://chrisyue.com/>
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
namespace Chrisyue\PhpM3u8\Tag;
13
14
/**
15
 * Class ProgramDateTimeTag
16
 */
17 View Code Duplication
class ProgramDateTimeTag extends AbstractTag
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
18
{
19
    use SingleValueTagTrait;
20
21
    const TAG_IDENTIFIER = '#EXT-X-PROGRAM-DATE-TIME';
22
23
    /**
24
     * @var string Absolute date and/or time of the first sample of the Media Segment in ISO_8601 format
25
     */
26
    private $programDateTime;
27
28
    /**
29
     * @param string $programDateTime
30
     * @return $this
31
     */
32
    public function setProgramDateTime($programDateTime)
33
    {
34
        $this->programDateTime = $programDateTime;
35
36
        return $this;
37
    }
38
39
    /**
40
     * @return string
41
     */
42
    public function getProgramDateTime()
43
    {
44
        return $this->programDateTime;
45
    }
46
47
    /**
48
     * @return string
49
     */
50 1
    public function dump()
51
    {
52 1
        return sprintf('%s:%d', self::TAG_IDENTIFIER, $this->programDateTime);
53
    }
54
55
    /**
56
     * @param string $line
57
     */
58
    protected function read($line)
59
    {
60
        $this->programDateTime = self::extractValue($line);
61
    }
62
}
63