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

Frame::getRemoteAddress()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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