ArrayValueExpectations::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Dgame\Expectation;
4
5
/**
6
 * Class ArrayValueExpectations
7
 * @package Dgame\Expectation
8
 */
9
/**
10
 * Class ArrayValueExpectations
11
 * @package Dgame\Expectation
12
 */
13
final class ArrayValueExpectations
14
{
15
    use ConditionTrait;
16
17
    /**
18
     * ArrayValueExpectations constructor.
19
     *
20
     * @param mixed $value
21
     */
22 2
    public function __construct($value)
23
    {
24 2
        $this->value = $value;
25 2
    }
26
27
    /**
28
     * @param array $values
29
     *
30
     * @return ArrayValueExpectations
31
     */
32 1
    public function isIn(array $values): self
33
    {
34 1
        return $this->approveIf(in_array($this->value, $values, true));
35
    }
36
37
    /**
38
     * @param array $values
39
     *
40
     * @return ArrayValueExpectations
41
     */
42 1
    public function isKeyOf(array $values): self
43
    {
44 1
        return $this->approveIf(array_key_exists($this->value, $values));
45
    }
46
}
47