SelfReturn::canHandle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 2
eloc 2
nc 2
nop 0
crap 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