Debug::__construct()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 0
cts 6
cp 0
rs 9.9666
c 0
b 0
f 0
cc 3
nc 2
nop 2
crap 12
1
<?php
2
3
namespace Fhp\Adapter;
4
5
use Fhp\Adapter\Exception\AdapterException;
6
use Fhp\Message\AbstractMessage;
7
8
/**
9
 * Class Debug Adapter.
10
 *
11
 * Use it to debug requests.
12
 *
13
 * @package Fhp\Adapter
14
 */
15
class Debug implements AdapterInterface
16
{
17
    /**
18
     * @var string
19
     */
20
    protected $host;
21
22
    /**
23
     * @var int
24
     */
25
    protected $port;
26
27
    /**
28
     * Debug constructor.
29
     *
30
     * @param $host
31
     * @param $port
32
     * @throws AdapterException
33
     */
34
    public function __construct($host, $port)
35
    {
36
        if (!is_integer($port) || (int) $port <= 0) {
37
            throw new AdapterException('Invalid port number');
38
        }
39
40
        $this->host = (string) $host;
41
        $this->port = (int) $port;
42
    }
43
44
    /**
45
     * Should return a dummy response body.
46
     *
47
     * @param AbstractMessage $message
48
     * @return string
49
     */
50
    public function send(AbstractMessage $message)
51
    {
52
        /* @todo Implement me
53
         * return file_get_contents(__DIR__ . '/../../../develop/accounts_response.txt');
54
         */
55
    }
56
}
57