Completed
Push — id3-metadata-objects ( 384c4c...c855dc )
by Daniel
02:54
created

Header::setRevision()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 5
ccs 0
cts 3
cp 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * This file is part of the Metadata package.
4
 *
5
 * @author Daniel Schröder <[email protected]>
6
 */
7
8
namespace GravityMedia\Metadata\ID3v2;
9
10
/**
11
 * ID3v2 header class.
12
 *
13
 * @package GravityMedia\Metadata
14
 */
15 View Code Duplication
class Header
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...
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