Completed
Pull Request — master (#3)
by thomas
17:44
created

DebugDecorator   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 30
ccs 0
cts 21
cp 0
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A recv() 0 5 1
A __construct() 0 3 1
A send() 0 5 1
A close() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BitWasp\PinEntry\Process;
6
7
use BitWasp\PinEntry\Response;
8
9
class DebugDecorator implements ProcessInterface
10
{
11
    /**
12
     * @var ProcessInterface
13
     */
14
    private $process;
15
16
    public function __construct(ProcessInterface $process)
17
    {
18
        $this->process = $process;
19
    }
20
21
    public function close(): bool
22
    {
23
        echo sprintf("%s()\n", __METHOD__);
24
        return $this->process->close();
25
    }
26
27
    public function recv(): string
28
    {
29
        echo sprintf("%s()\n", __METHOD__);
30
        $recv = $this->process->recv();
31
        return $recv;
32
    }
33
34
    public function send(string $data)
35
    {
36
        echo sprintf("%s(%s)\n", __METHOD__, trim($data));
37
        $send = $this->process->send($data);
38
        return $send;
39
    }
40
}
41