Completed
Pull Request — master (#25)
by
unknown
05:59 queued 04:47
created

Criteria::check()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 4

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 5
cts 5
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
        }
22
23 2
        return true;
24
    }
25
}
26