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

MethodProphecyHelper   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 31
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A set() 0 4 1
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