Completed
Branch 0.4-dev (999b58)
by Evgenij
18:41
created

WriteEvent   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getOperation() 0 4 1
A __construct() 0 9 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\Event;
11
12
use AsyncSockets\RequestExecutor\RequestExecutorInterface;
13
use AsyncSockets\Operation\WriteOperation;
14
use AsyncSockets\Socket\SocketInterface;
15
16
/**
17
 * Class WriteEvent
18
 */
19
class WriteEvent extends IoEvent
20
{
21
    /**
22
     * Operation to be used in I/O
23
     *
24
     * @var WriteOperation
25
     */
26
    private $operation;
27
28
    /**
29
     * Constructor
30
     *
31
     * @param WriteOperation           $operation Operation, which will be used in I/O
32
     * @param RequestExecutorInterface $executor Request executor object
33
     * @param SocketInterface          $socket   Socket for this request
34
     * @param mixed                    $context  Any optional user data for event
35
     */
36 45
    public function __construct(
37
        WriteOperation $operation,
38
        RequestExecutorInterface $executor,
39
        SocketInterface $socket,
40
        $context
41
    ) {
42 45
        parent::__construct($executor, $socket, $context, EventType::WRITE);
43 45
        $this->operation = $operation;
44 45
    }
45
46
    /**
47
     * Return operation object
48
     *
49
     * @return WriteOperation
50
     */
51 6
    public function getOperation()
52
    {
53 6
        return $this->operation;
54
    }
55
}
56