Completed
Pull Request — master (#257)
by Éloi
01:56
created

MediaHash::setAlgo()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php declare(strict_types=1);
2
/*
3
 * This file is part of the feed-io package.
4
 *
5
 * (c) Alexandre Debril <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace FeedIo\Feed\Item;
12
13
abstract class MediaHashAlgo extends MediaConstant
14
{
15
    const MD5 = 1;
16
    const SHA1 = 2;
17
18
    const VALUES = array(
19
        null => MediaHashAlgo::MD5,
20
        "md5" => MediaHashAlgo::MD5,
21
        "sha1" => MediaHashAlgo::SHA1,
22
    );
23
}
24
25
26
class MediaHash implements MediaHashInterface
27
{
28
    /**
29
     * @var string
30
     */
31
    protected $content;
32
33
    /**
34
     * @var int
35
     */
36
    protected $algo;
37
38
    /**
39
     * @return string
40
     */
41 2
    public function getContent() : ?string
42
    {
43 2
        return $this->content;
44
    }
45
46
    /**
47
     * @param  string $content
48
     * @return MediaHashInterface
49
     */
50 2
    public function setContent(?string $content) : MediaHashInterface
51
    {
52 2
        $this->content = $content;
53
54 2
        return $this;
55
    }
56
57
    /**
58
     * @return string
59
     */
60 2
    public function getAlgo() : ?int
61
    {
62 2
        return $this->algo;
63
    }
64
65
    /**
66
     * @param  int $algo
67
     * @return MediaHashInterface
68
     */
69 2
    public function setAlgo(?int $algo) : MediaHashInterface
70
    {
71 2
        $this->algo = $algo;
72
73 2
        return $this;
74
    }
75
}
76