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

WriteEvent::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

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