GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

SSLRequestCommand::resetSequence()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 2
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Plasma Driver MySQL component
4
 * Copyright 2018-2019 PlasmaPHP, All Rights Reserved
5
 *
6
 * Website: https://github.com/PlasmaPHP
7
 * License: https://github.com/PlasmaPHP/driver-mysql/blob/master/LICENSE
8
*/
9
10
namespace Plasma\Drivers\MySQL\Commands;
11
12
/**
13
 * SSLRequest command.
14
 * @internal
15
 */
16
class SSLRequestCommand implements CommandInterface {
17
    use \Evenement\EventEmitterTrait;
18
    
19
    /**
20
     * @var \Plasma\Drivers\MySQL\Messages\HandshakeMessage
21
     */
22
    protected $handshake;
23
    
24
    /**
25
     * @var int
26
     */
27
    protected $capability;
28
    
29
    /**
30
     * @var bool
31
     */
32
    protected $finished = false;
33
    
34
    /**
35
     * Constructor.
36
     * @param \Plasma\Drivers\MySQL\Messages\HandshakeMessage  $handshake
37
     * @param int                                              $capability
38
     */
39 7
    function __construct(\Plasma\Drivers\MySQL\Messages\HandshakeMessage $handshake, int $capability) {
40 7
        $this->handshake = $handshake;
41 7
        $this->capability = $capability;
42 7
    }
43
    
44
    /**
45
     * Get the encoded message for writing to the database connection.
46
     * @return string
47
     */
48 1
    function getEncodedMessage(): string {
49 1
        $maxPacketSize = \Plasma\Drivers\MySQL\ProtocolParser::CLIENT_MAX_PACKET_SIZE;
50 1
        $charsetNumber = \Plasma\Drivers\MySQL\ProtocolParser::CLIENT_CHARSET_NUMBER;
51
        
52 1
        $packet = \pack('VVc', $this->capability, $maxPacketSize, $charsetNumber);
53 1
        $packet .= \str_repeat("\x00", 23);
54
        
55 1
        $this->finished = true;
56 1
        return $packet;
57
    }
58
    
59
    /**
60
     * Sets the parser state, if necessary. If not, return `-1`.
61
     * @return int
62
     */
63 1
    function setParserState(): int {
64 1
        return \Plasma\Drivers\MySQL\ProtocolParser::STATE_HANDSHAKE;
65
    }
66
    
67
    /**
68
     * Sets the command as completed. This state gets reported back to the user.
69
     * @return void
70
     */
71 1
    function onComplete(): void {
72 1
        $this->finished = true;
73 1
        $this->emit('end');
74 1
    }
75
    
76
    /**
77
     * Sets the command as errored. This state gets reported back to the user.
78
     * @param \Throwable  $throwable
79
     * @return void
80
     */
81 1
    function onError(\Throwable $throwable): void {
82 1
        $this->finished = true;
83 1
        $this->emit('error', array($throwable));
84 1
    }
85
    
86
    /**
87
     * Sends the next received value into the command.
88
     * @param mixed  $value
89
     * @return void
90
     */
91 1
    function onNext($value): void {
92
        // Nothing to do
93 1
    }
94
    
95
    /**
96
     * Whether the command has finished.
97
     * @return bool
98
     */
99 1
    function hasFinished(): bool {
100 1
        return $this->finished;
101
    }
102
    
103
    /**
104
     * Whether this command sets the connection as busy.
105
     * @return bool
106
     */
107 1
    function waitForCompletion(): bool {
108 1
        return false;
109
    }
110
    
111
    /**
112
     * Whether the sequence ID should be resetted.
113
     * @return bool
114
     */
115 1
    function resetSequence(): bool {
116 1
        return false;
117
    }
118
}
119