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.

EOFMessage   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Test Coverage

Coverage 12.5%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 74
ccs 2
cts 16
cp 0.125
rs 10
wmc 6

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A getParser() 0 2 1
A getID() 0 2 1
A parseMessage() 0 10 2
A setParserState() 0 2 1
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\Messages;
11
12
/**
13
 * Represents an EOF Message.
14
 */
15
class EOFMessage implements \Plasma\Drivers\MySQL\Messages\MessageInterface {
16
    /**
17
     * The server status flags.
18
     * @var int
19
     * @see \Plasma\Drivers\MySQL\StatusFlags
20
     */
21
    public $statusFlags;
22
    
23
    /**
24
     * Count of warnings.
25
     * @var int
26
     */
27
    public $warningsCount;
28
    
29
    /**
30
     * @var \Plasma\Drivers\MySQL\ProtocolParser
31
     * @internal
32
     */
33
    protected $parser;
34
    
35
    /**
36
     * Constructor.
37
     * @param \Plasma\Drivers\MySQL\ProtocolParser  $parser
38
     * @internal
39
     */
40
    function __construct(\Plasma\Drivers\MySQL\ProtocolParser $parser) {
41
        $this->parser = $parser;
42
    }
43
    
44
    /**
45
     * Get the identifier for the packet.
46
     * @return string
47
     * @internal
48
     */
49 49
    static function getID(): string {
50 49
        return "\xFE";
51
    }
52
    
53
    /**
54
     * Parses the message, once the complete string has been received.
55
     * Returns false if not enough data has been received, or the remaining buffer.
56
     * @param \Plasma\BinaryBuffer  $buffer
57
     * @return bool
58
     * @throws \Plasma\Drivers\MySQL\Messages\ParseException
59
     * @internal
60
     */
61
    function parseMessage(\Plasma\BinaryBuffer $buffer): bool {
62
        $handshake = $this->parser->getHandshakeMessage();
63
        if(!$handshake) {
64
            throw new \Plasma\Drivers\MySQL\Messages\ParseException('No handshake message when receiving ok response packet');
65
        }
66
        
67
        $this->statusFlags = $buffer->readInt2();
68
        $this->warningsCount = $buffer->readInt2();
69
        
70
        return true;
71
    }
72
    
73
    /**
74
     * Get the parser which created this message.
75
     * @return \Plasma\Drivers\MySQL\ProtocolParser
76
     * @internal
77
     */
78
    function getParser(): \Plasma\Drivers\MySQL\ProtocolParser {
79
        return $this->parser;
80
    }
81
    
82
    /**
83
     * Sets the parser state, if necessary. If not, return `-1`.
84
     * @return int
85
     * @internal
86
     */
87
    function setParserState(): int {
88
        return \Plasma\Drivers\MySQL\ProtocolParser::STATE_OK;
89
    }
90
}
91