Passed
Push — master ( 029b26...a8153c )
by Harry
02:04
created

FlagTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 25
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A isFlagSet() 0 3 1
A setFlags() 0 3 1
1
<?php
2
3
namespace Graze\ArrayMerger;
4
5
trait FlagTrait
6
{
7
    /** @var int */
8
    private $flags;
9
10
    /**
11
     * Set the flags to be checked against
12
     *
13
     * @param int $flags
14
     */
15 40
    protected function setFlags($flags)
16
    {
17 40
        $this->flags = $flags;
18 40
    }
19
20
    /**
21
     * Is the provided flag set?
22
     *
23
     * @param int $flag
24
     *
25
     * @return bool
26
     */
27 38
    protected function isFlagSet($flag)
28
    {
29 38
        return ($this->flags & $flag) === $flag;
30
    }
31
}
32