Completed
Push — master ( b268cf...c6aad7 )
by Oliver
07:45
created

Criteria::check()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 20

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 0
cts 9
cp 0
rs 9.9332
c 0
b 0
f 0
cc 4
nc 3
nop 1
crap 20
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
    public function check(\ArrayAccess $keyvalue)
16
    {
17
        foreach ($this as $key => $value) {
18
            if (!($keyvalue->offsetExists($key) && ($keyvalue->offsetGet($key) === $value))) {
19
                return false;
20
            }
21
        }
22
23
        return true;
24
    }
25
}
26