Completed
Push — master ( e1eaf9...3b6dfb )
by Thanos
01:48
created

Resolver::resolveAndModifyStub()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 10
nc 1
nop 0
1
<?php
2
3
namespace Amock\MockMethod;
4
5
use PHPUnit\Framework\TestCase;
6
7
class Resolver
8
{
9
    private $testCase;
10
11
    private $initialStub;
12
13
    private $methodName;
14
15
    private $methodMockConfig;
16
17 View Code Duplication
    public function __construct(TestCase $testCase, $initialStub, string $methodName, $methodMockConfig)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
18
    {
19
        $this->testCase = $testCase;
20
        $this->initialStub = $initialStub;
21
        $this->methodName = $methodName;
22
        $this->methodMockConfig = $methodMockConfig;
23
    }
24
25
    public function resolveAndModifyStub()
26
    {
27
        $valueReturn = new ValueReturn($this->testCase, $this->initialStub, $this->methodName, $this->methodMockConfig);
28
        $literalReturn = new LiteralReturn($this->testCase, $this->initialStub, $this->methodName, $this->methodMockConfig);
29
        $selfReturn = new SelfReturn($this->testCase, $this->initialStub, $this->methodName, $this->methodMockConfig);
30
        $consecutiveCallsReturn = new ConsecutiveCallsReturn($this->testCase, $this->initialStub, $this->methodName, $this->methodMockConfig);
31
        $exceptionThrow = new ExceptionThrow($this->testCase, $this->initialStub, $this->methodName, $this->methodMockConfig);
32
    
33
        $valueReturn->setSuccessor($literalReturn);
34
        $literalReturn->setSuccessor($selfReturn);
35
        $selfReturn->setSuccessor($consecutiveCallsReturn);
36
        $consecutiveCallsReturn->setSuccessor($exceptionThrow);
37
38
        return $valueReturn->process();
39
    }
40
}
41
42