Connection   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 35
c 0
b 0
f 0
wmc 3
lcom 1
cbo 1
ccs 7
cts 7
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A send() 0 4 1
A getAdapter() 0 4 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