Completed
Push — master ( 9edfc5...0d667f )
by Evgenij
03:15
created

ReadOperation   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 2
A getFramePicker() 0 4 1
A getTypes() 0 4 1
1
<?php
2
/**
3
 * Async sockets
4
 *
5
 * @copyright Copyright (c) 2015-2017, 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\Operation;
11
12
use AsyncSockets\Frame\FramePickerInterface;
13
use AsyncSockets\Frame\RawFramePicker;
14
15
/**
16
 * Class ReadOperation
17
 */
18
class ReadOperation implements OperationInterface
19
{
20
    /**
21
     * Frame picker object
22
     *
23
     * @var FramePickerInterface
24
     */
25
    private $framePicker;
26
27
    /**
28
     * ReadOperation constructor.
29
     *
30
     * @param FramePickerInterface $framePicker Frame picker object
31
     */
32 65
    public function __construct(FramePickerInterface $framePicker = null)
33
    {
34 65
        $this->framePicker = $framePicker ?: new RawFramePicker();
35 65
    }
36
37
38
    /** {@inheritdoc} */
39 88
    public function getTypes()
40
    {
41 88
        return [self::OPERATION_READ];
42
    }
43
44
    /**
45
     * Return FramePicker
46
     *
47
     * @return FramePickerInterface
48
     */
49 55
    public function getFramePicker()
50
    {
51 55
        return $this->framePicker;
52
    }
53
}
54