Completed
Push — master ( a7af36...1cb211 )
by Evgenij
02:42
created

Frame   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 0 Features 2
Metric Value
wmc 4
c 4
b 0
f 2
lcom 0
cbo 0
dl 0
loc 46
ccs 10
cts 10
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getData() 0 4 1
A __toString() 0 4 1
A getRemoteAddress() 0 4 1
1
<?php
2
/**
3
 * Async sockets
4
 *
5
 * @copyright Copyright (c) 2015, Efimov Evgenij <[email protected]>
6
 *
7
 * This source file is subject to the MIT license that is bundled
8
 * with this source code in the file LICENSE.
9
 */
10
namespace AsyncSockets\Frame;
11
12
/**
13
 * Class Frame
14
 */
15
class Frame implements FrameInterface
16
{
17
    /**
18
     * Data from network for this object
19
     *
20
     * @var string
21
     */
22
    private $data;
23
24
    /**
25
     * The source address of this frame
26
     *
27
     * @var string
28
     */
29
    private $remoteAddress;
30
31
    /**
32
     * SocketResponse constructor.
33
     *
34
     * @param string $data Data from network for this response
35
     * @param string $remoteAddress The source address of this frame
36
     */
37 84
    public function __construct($data, $remoteAddress)
38
    {
39 84
        $this->data = (string) $data;
40 84
        $this->remoteAddress = $remoteAddress;
41 84
    }
42
43
    /** {@inheritdoc} */
44 68
    public function getData()
45
    {
46 68
        return $this->data;
47
    }
48
49
    /** {@inheritdoc} */
50 66
    public function __toString()
51
    {
52 66
        return $this->getData();
53
    }
54
55
    /** {@inheritdoc} */
56 43
    public function getRemoteAddress()
57
    {
58 43
        return $this->remoteAddress;
59
    }
60
}
61