Code Duplication    Length = 73-73 lines in 2 locations

src/ID3v2/ExtendedHeader.php 1 location

@@ 15-87 (lines=73) @@
12
 *
13
 * @package GravityMedia\Metadata\ID3v2
14
 */
15
class ExtendedHeader
16
{
17
    /**
18
     * @var int
19
     */
20
    protected $size;
21
22
    /**
23
     * @var array
24
     */
25
    protected $flags;
26
27
    /**
28
     * Create ID3v2 extended header object.
29
     */
30
    public function __construct()
31
    {
32
        $this->size = 0;
33
        $this->flags = [];
34
    }
35
36
    /**
37
     * Get size in bytes.
38
     *
39
     * @return int
40
     */
41
    public function getSize()
42
    {
43
        return $this->size;
44
    }
45
46
    /**
47
     * Set size in bytes.
48
     *
49
     * @param int $size
50
     *
51
     * @return $this
52
     */
53
    public function setSize($size)
54
    {
55
        $this->size = $size;
56
        return $this;
57
    }
58
59
    /**
60
     * Whether the flag is enabled.
61
     *
62
     * @param int $flag
63
     *
64
     * @return bool
65
     */
66
    public function isFlagEnabled($flag)
67
    {
68
        if (isset($this->flags[$flag])) {
69
            return $this->flags[$flag];
70
        }
71
72
        return false;
73
    }
74
75
    /**
76
     * Set flags.
77
     *
78
     * @param array $flags
79
     *
80
     * @return $this
81
     */
82
    public function setFlags(array $flags)
83
    {
84
        $this->flags = $flags;
85
        return $this;
86
    }
87
}
88

src/ID3v2/Header.php 1 location

@@ 15-87 (lines=73) @@
12
 *
13
 * @package GravityMedia\Metadata
14
 */
15
class Header
16
{
17
    /**
18
     * @var int
19
     */
20
    protected $size;
21
22
    /**
23
     * @var array
24
     */
25
    protected $flags;
26
27
    /**
28
     * Create ID3v2 header object.
29
     */
30
    public function __construct()
31
    {
32
        $this->size = 0;
33
        $this->flags = [];
34
    }
35
36
    /**
37
     * Get size in bytes.
38
     *
39
     * @return int
40
     */
41
    public function getSize()
42
    {
43
        return $this->size;
44
    }
45
46
    /**
47
     * Set size in bytes.
48
     *
49
     * @param int $size
50
     *
51
     * @return $this
52
     */
53
    public function setSize($size)
54
    {
55
        $this->size = $size;
56
        return $this;
57
    }
58
59
    /**
60
     * Whether the flag is enabled.
61
     *
62
     * @param int $flag
63
     *
64
     * @return bool
65
     */
66
    public function isFlagEnabled($flag)
67
    {
68
        if (isset($this->flags[$flag])) {
69
            return $this->flags[$flag];
70
        }
71
72
        return false;
73
    }
74
75
    /**
76
     * Set flags.
77
     *
78
     * @param array $flags
79
     *
80
     * @return $this
81
     */
82
    public function setFlags(array $flags)
83
    {
84
        $this->flags = $flags;
85
        return $this;
86
    }
87
}
88