Completed
Push — master ( db026b...56b106 )
by Oliver
04:09 queued 02:28
created

Criteria::check()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 4

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 6
cts 6
cp 1
rs 9.9332
c 0
b 0
f 0
cc 4
nc 3
nop 1
crap 4
1
<?php
2
3
namespace Metabor\KeyValue;
4
5
/**
6
 * @author otischlinger
7
 */
8
class Criteria extends \ArrayObject
9
{
10
    /**
11
     * @param \ArrayAccess $keyvalue
12
     *
13
     * @return bool
14
     */
15 4
    public function check(\ArrayAccess $keyvalue)
16
    {
17 4
        foreach ($this as $key => $value) {
18 4
            if (!($keyvalue->offsetExists($key) && ($keyvalue->offsetGet($key) === $value))) {
19 3
                return false;
20
            }
21 4
        }
22
23 2
        return true;
24
    }
25
}
26