Passed
Push — master ( 1ee315...5b8b15 )
by Thanos
02:00
created

NullReturn   A

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 NullReturn extends Handler
6
{
7 6
    public function handle(): bool
8
    {
9 6
        if (!$this->canHandle()) {
10 5
            return false;
11
        }
12
13 1
        $this->initialStub
14 1
            ->method($this->methodName)
15 1
            ->willReturn(null);
16
17 1
        return true;
18
    }
19
20 6
    private function canHandle(): bool
21
    {
22 6
        return is_string($this->methodMockConfig)
23 6
            && substr($this->methodMockConfig, 0, 5) === '@null';
24
    }
25
}
26