SelfReturn   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
dl 0
loc 19
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 11 2
A canHandle() 0 4 2
1
<?php
2
3
namespace Amock\MockMethod;
4
5
class SelfReturn extends Handler
6
{
7 15
    public function handle(): bool
8
    {
9 15
        if (!$this->canHandle()) {
10 14
            return false;
11
        }
12
13 1
        $this->initialStub
14 1
            ->method($this->methodName)
15 1
            ->will($this->testCase->returnSelf());
16
17 1
        return true;
18
    }
19
20 15
    private function canHandle(): bool
21
    {
22 15
        return is_string($this->methodMockConfig)
23 15
            && substr($this->methodMockConfig, 0, 5) === '@self';
24
    }
25
}
26