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

Frame   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 158
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 12
c 3
b 0
f 0
lcom 1
cbo 0
dl 0
loc 158
ccs 0
cts 32
cp 0
rs 10

11 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getName() 0 4 1
A setName() 0 5 1
A getSize() 0 4 1
A setSize() 0 5 1
A isFlagEnabled() 0 8 2
A setFlags() 0 5 1
A getDataLength() 0 4 1
A setDataLength() 0 5 1
A getData() 0 4 1
A setData() 0 5 1
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 frame class.
12
 *
13
 * @package GravityMedia\Metadata
14
 */
15
class Frame
16
{
17
    /**
18
     * @var string
19
     */
20
    protected $name;
21
22
    /**
23
     * @var int
24
     */
25
    protected $size;
26
27
    /**
28
     * @var array
29
     */
30
    protected $flags;
31
32
    /**
33
     * @var int
34
     */
35
    protected $dataLength;
36
37
    /**
38
     * @var string
39
     */
40
    protected $data;
41
42
    /**
43
     * Create ID3v2 frame object.
44
     */
45
    public function __construct()
46
    {
47
        $this->size = 0;
48
        $this->flags = [];
49
        $this->dataLength = 0;
50
    }
51
52
    /**
53
     * Get name.
54
     *
55
     * @return string
56
     */
57
    public function getName()
58
    {
59
        return $this->name;
60
    }
61
62
    /**
63
     * Set name.
64
     *
65
     * @param string $name
66
     *
67
     * @return $this
68
     */
69
    public function setName($name)
70
    {
71
        $this->name = $name;
72
        return $this;
73
    }
74
75
    /**
76
     * Get size in bytes.
77
     *
78
     * @return int
79
     */
80
    public function getSize()
81
    {
82
        return $this->size;
83
    }
84
85
    /**
86
     * Set size in bytes.
87
     *
88
     * @param int $size
89
     *
90
     * @return $this
91
     */
92
    public function setSize($size)
93
    {
94
        $this->size = $size;
95
        return $this;
96
    }
97
98
    /**
99
     * Whether the flag is enabled.
100
     *
101
     * @param int $flag
102
     *
103
     * @return bool
104
     */
105
    public function isFlagEnabled($flag)
106
    {
107
        if (isset($this->flags[$flag])) {
108
            return $this->flags[$flag];
109
        }
110
111
        return false;
112
    }
113
114
    /**
115
     * Set flags.
116
     *
117
     * @param array $flags
118
     *
119
     * @return $this
120
     */
121
    public function setFlags(array $flags)
122
    {
123
        $this->flags = $flags;
124
        return $this;
125
    }
126
127
    /**
128
     * Get data length.
129
     *
130
     * @return int
131
     */
132
    public function getDataLength()
133
    {
134
        return $this->dataLength;
135
    }
136
137
    /**
138
     * Set data length.
139
     *
140
     * @param int $dataLength
141
     *
142
     * @return $this
143
     */
144
    public function setDataLength($dataLength)
145
    {
146
        $this->dataLength = $dataLength;
147
        return $this;
148
    }
149
150
    /**
151
     * Get data.
152
     *
153
     * @return string
154
     */
155
    public function getData()
156
    {
157
        return $this->data;
158
    }
159
160
    /**
161
     * Set data.
162
     *
163
     * @param string $data
164
     *
165
     * @return $this
166
     */
167
    public function setData($data)
168
    {
169
        $this->data = $data;
170
        return $this;
171
    }
172
}
173