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

DebugDecorator::waitFor()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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