Completed
Push — master ( 1cb211...95ea2a )
by Evgenij
03:22
created

SslHandshakeOperation::getNextOperation()   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 0
Metric Value
c 1
b 0
f 0
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\Operation;
11
12
/**
13
 * Class SslHandshakeOperation
14
 */
15
class SslHandshakeOperation implements OperationInterface
16
{
17
    /**
18
     * Cipher to use for SSL encryption
19
     *
20
     * @var int
21
     */
22
    private $cipher;
23
24
    /**
25
     * I/O operation after handshake will complete
26
     *
27
     * @var OperationInterface
28
     */
29
    private $nextOperation;
30
31
    /**
32
     * SslHandshakeOperation constructor.
33
     *
34
     * @param OperationInterface $nextOperation I/O operation after handshake will complete
35
     * @param int                $cipher Cipher to use for SSL encryption
36
     */
37 2
    public function __construct(OperationInterface $nextOperation = null, $cipher = STREAM_CRYPTO_METHOD_TLS_CLIENT)
38
    {
39 2
        $this->nextOperation = $nextOperation;
40 2
        $this->cipher        = $cipher;
41 2
    }
42
43
    /** {@inheritdoc} */
44 1
    public function getType()
45
    {
46 1
        return self::OPERATION_WRITE;
47
    }
48
49
    /**
50
     * Return Cipher
51
     *
52
     * @return int
53
     */
54 3
    public function getCipher()
55
    {
56 3
        return $this->cipher;
57
    }
58
59
    /**
60
     * Return NextOperation
61
     *
62
     * @return OperationInterface
63
     */
64 2
    public function getNextOperation()
65
    {
66 2
        return $this->nextOperation;
67
    }
68
}
69