Passed
Push — master ( a7f03b...b76a97 )
by Dan
01:56
created

Expectations::set()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Nopolabs\Test;
5
6
use PHPUnit_Framework_MockObject_MockObject;
7
8
class Expectations
9
{
10
    /** @var array */
11
    private $expectations;
12
13
    public function __construct(array $expectations)
14
    {
15
        $this->expectations = $expectations;
16
    }
17
18
    public function getExpectedMethods() : array
19
    {
20
        return array_unique(array_map(
21
            function(Expectation $expectation) {
22
                return $expectation->getMethod();
23
            }, $this->expectations
24
        ));
25
    }
26
27
    public function set(PHPUnit_Framework_MockObject_MockObject $mock) : void
28
    {
29
        array_walk(
30
            $this->expectations,
31
            function(Expectation $expectation) use ($mock) {
32
                $expectation->set($mock);
33
            }
34
        );
35
    }
36
}
37