Completed
Push — master ( 7ee214...32fd8d )
by Alberto
19s
created

MethodProphecyHelper::set()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Moka\Plugin\Prophecy;
5
6
use Prophecy\Argument\Token\TokenInterface;
7
use Prophecy\Prophecy\MethodProphecy;
8
use Prophecy\Prophecy\ObjectProphecy;
9
10
/**
11
 * Class MethodProphecyHelper
12
 * @package Moka\Plugin\Prophecy
13
 */
14
class MethodProphecyHelper
15
{
16
    /**
17
     * @var ObjectProphecy
18
     */
19
    private $mock;
20
21
    /**
22
     * @var string
23
     */
24
    private $methodName;
25
26
    /**
27
     * @param ObjectProphecy $mock
28
     * @param string $methodName
29
     */
30 2
    public function __construct(ObjectProphecy $mock, string $methodName)
31
    {
32 2
        $this->mock = $mock;
33 2
        $this->methodName = $methodName;
34
    }
35
36
    /**
37
     * @param TokenInterface|null $token
38
     * @return MethodProphecy
39
     */
40 2
    public function set(TokenInterface $token = null): MethodProphecy
41
    {
42 2
        return $this->mock->{$this->methodName}($token);
43
    }
44
}
45