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 ( 3db31b...96398e )
by Charlotte
02:14
created

AuthSwitchRequestMessage::getParser()   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 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 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 Auth Switch Request Message.
14
 * @internal
15
 */
16
class AuthSwitchRequestMessage implements \Plasma\Drivers\MySQL\Messages\MessageInterface {
17
    /**
18
     * @var string|null
19
     */
20
    public $authPluginName;
21
    
22
    /**
23
     * @var string|null
24
     */
25
    public $authPluginData;
26
    
27
    /**
28
     * @var \Plasma\Drivers\MySQL\ProtocolParser
29
     */
30
    protected $parser;
31
    
32
    /**
33
     * Constructor.
34
     * @param \Plasma\Drivers\MySQL\ProtocolParser  $parser
35
     */
36 4
    function __construct(\Plasma\Drivers\MySQL\ProtocolParser $parser) {
37 4
        $this->parser = $parser;
38 4
    }
39
    
40
    /**
41
     * Get the identifier for the packet.
42
     * @return string
43
     */
44 1
    static function getID(): string {
45 1
        return "\xFE";
46
    }
47
    
48
    /**
49
     * Parses the message, once the complete string has been received.
50
     * Returns false if not enough data has been received, or the remaining buffer.
51
     * @param \Plasma\BinaryBuffer  $buffer
52
     * @return bool
53
     * @throws \Plasma\Drivers\MySQL\Messages\ParseException
54
     */
55 1
    function parseMessage(\Plasma\BinaryBuffer $buffer): bool {
56
        try {
57 1
            $this->authPluginName = $buffer->readStringNull();
58
            
59 1
            if($buffer->getSize() > 0) {
60 1
                $this->authPluginData = $buffer->getContents();
61 1
                $buffer->clear();
62
            }
63
            
64 1
            return true;
65
        } catch (\InvalidArgumentException $e) {
66
            return false;
67
        }
68
    }
69
    
70
    /**
71
     * Get the parser which created this message.
72
     * @return \Plasma\Drivers\MySQL\ProtocolParser
73
     */
74 1
    function getParser(): \Plasma\Drivers\MySQL\ProtocolParser {
75 1
        return $this->parser;
76
    }
77
    
78
    /**
79
     * Sets the parser state, if necessary. If not, return `-1`.
80
     * @return int
81
     */
82 1
    function setParserState(): int {
83 1
        return \Plasma\Drivers\MySQL\ProtocolParser::STATE_AUTH_SENT;
84
    }
85
}
86