Completed
Branch master (1d1574)
by Evgenij
18:38
created

RawFramePicker::doHandleData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 3
crap 1
1
<?php
2
/**
3
 * Async sockets
4
 *
5
 * @copyright Copyright (c) 2015-2016, 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 RawFramePicker. This FramePicker allows to get chunks from network as it was read by fread
14
 */
15
class RawFramePicker extends AbstractFramePicker
16
{
17
    /** {@inheritdoc} */
18 16
    protected function doHandleData($chunk, $remoteAddress, &$buffer)
19
    {
20 16
        $buffer = $chunk;
21 16
        $this->setFinished(true);
22 16
        return '';
23
    }
24
25
    /** {@inheritdoc} */
26 16
    protected function doCreateFrame($buffer, $remoteAddress)
27
    {
28 16
        return new Frame($buffer, $remoteAddress);
29
    }
30
}
31