Completed
Push — id3-metadata-objects ( c855dc...168cf3 )
by Daniel
03:05
created

Flags   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A isEnabled() 0 8 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 flags class.
12
 *
13
 * @package GravityMedia\Metadata
14
 */
15
class Flags
16
{
17
    /**
18
     * @var array
19
     */
20
    protected $flags;
21
22
    /**
23
     * Create ID3v2 flags object.
24
     *
25
     * @param array $flags
26
     */
27
    public function __construct(array $flags = [])
28
    {
29
        $this->flags = $flags;
30
    }
31
32
    /**
33
     * Whether the flag is enabled.
34
     *
35
     * @param int $flag
36
     *
37
     * @return bool
38
     */
39
    public function isEnabled($flag)
40
    {
41
        if (isset($this->flags[$flag])) {
42
            return $this->flags[$flag];
43
        }
44
45
        return false;
46
    }
47
}
48