Expectations::getExpectedMethods()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 6
rs 10
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