Completed
Push — master ( 9d6b90...0a141c )
by Randy
11:08
created

ArrayValueExpectations   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 34
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A isIn() 0 4 1
A isKeyOf() 0 4 1
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 $value
21
     */
22
    public function __construct($value)
23
    {
24
        $this->value = $value;
25
    }
26
27
    /**
28
     * @param array $values
29
     *
30
     * @return ArrayValueExpectations
31
     */
32
    public function isIn(array $values): self
33
    {
34
        return $this->approveIf(in_array($this->value, $values));
35
    }
36
37
    /**
38
     * @param array $values
39
     *
40
     * @return ArrayValueExpectations
41
     */
42
    public function isKeyOf(array $values): self
43
    {
44
        return $this->approveIf(array_key_exists($this->value, $values));
45
    }
46
}