Connection::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Fhp;
4
5
use Fhp\Adapter\AdapterInterface;
6
use Fhp\Message\AbstractMessage;
7
8
/**
9
 * Class Connection
10
 * @package Fhp
11
 */
12
class Connection
13
{
14
    /**
15
     * @var AdapterInterface
16
     */
17
    protected $adapter;
18
19
    /**
20
     * Connection constructor.
21
     * @param AdapterInterface $adapter
22
     */
23 2
    public function __construct(AdapterInterface $adapter)
24
    {
25 2
        $this->adapter = $adapter;
26 2
    }
27
28
    /**
29
     * Uses the configured adapter to send a message.
30
     *
31
     * @param AbstractMessage $message
32
     * @return string
33
     */
34 1
    public function send(AbstractMessage $message)
35
    {
36 1
        return iconv('ISO-8859-1', 'UTF-8', $this->adapter->send($message));
37
    }
38
39
    /**
40
     * @return AdapterInterface
41
     */
42 1
    public function getAdapter()
43
    {
44 1
        return $this->adapter;
45
    }
46
}
47