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.
Passed
Push — master ( f731b0...b5a8f2 )
by Charlotte
02:33
created

PrepareStatementOkMessage::__construct()   A

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 1
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\Messages;
11
12
/**
13
 * Represents a Prepare Statement Ok Message.
14
 * @internal
15
 */
16
class PrepareStatementOkMessage implements \Plasma\Drivers\MySQL\Messages\MessageInterface {
17
    /**
18
     * The statement ID.
19
     * @var int
20
     */
21
    public $statementID;
22
    
23
    /**
24
     * Count of columns.
25
     * @var int
26
     */
27
    public $numColumns;
28
    
29
    /**
30
     * Count of parameters.
31
     * @var int
32
     */
33
    public $numParams;
34
    
35
    /**
36
     * Count of warnings.
37
     * @var int
38
     */
39
    public $warningsCount;
40
    
41
    /**
42
     * @var \Plasma\Drivers\MySQL\ProtocolParser
43
     */
44
    protected $parser;
45
    
46
    /**
47
     * Constructor.
48
     * @param \Plasma\Drivers\MySQL\ProtocolParser  $parser
49
     */
50 36
    function __construct(\Plasma\Drivers\MySQL\ProtocolParser $parser) {
51 36
        $this->parser = $parser;
52 36
    }
53
    
54
    /**
55
     * Get the identifier for the packet.
56
     * @return string
57
     */
58
    static function getID(): string {
59
        return "\x00";
60
    }
61
    
62
    /**
63
     * Parses the message, once the complete string has been received.
64
     * Returns false if not enough data has been received, or the remaining buffer.
65
     * @param \Plasma\BinaryBuffer  $buffer
66
     * @return bool
67
     * @throws \Plasma\Drivers\MySQL\Messages\ParseException
68
     */
69 36
    function parseMessage(\Plasma\BinaryBuffer $buffer): bool {
70 36
        if($buffer->getSize() < 11) {
71
            return false;
72
        }
73
        
74 36
        $statementID = $buffer->readInt4();
75 36
        $numColumns = $buffer->readInt2();
76 36
        $numParams = $buffer->readInt2();
77
        
78 36
        $buffer->read(1); // Filler
79
        
80 36
        $warningsCount = $buffer->readInt2();
81
        
82 36
        $this->statementID = $statementID;
83 36
        $this->numColumns = $numColumns;
84 36
        $this->numParams = $numParams;
85 36
        $this->warningsCount = $warningsCount;
86
        
87 36
        return true;
88
    }
89
    
90
    /**
91
     * Get the parser which created this message.
92
     * @return \Plasma\Drivers\MySQL\ProtocolParser
93
     */
94
    function getParser(): \Plasma\Drivers\MySQL\ProtocolParser {
95
        return $this->parser;
96
    }
97
    
98
    /**
99
     * Sets the parser state, if necessary. If not, return `-1`.
100
     * @return int
101
     */
102 36
    function setParserState(): int {
103 36
        return \Plasma\Drivers\MySQL\ProtocolParser::STATE_OK;
104
    }
105
}
106