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.

PingCommand   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 82
Duplicated Lines 0 %

Test Coverage

Coverage 71.43%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 82
ccs 15
cts 21
cp 0.7143
rs 10
wmc 8

8 Methods

Rating   Name   Duplication   Size   Complexity  
A resetSequence() 0 2 1
A getEncodedMessage() 0 3 1
A onComplete() 0 3 1
A onNext() 0 1 1
A setParserState() 0 2 1
A waitForCompletion() 0 2 1
A hasFinished() 0 2 1
A onError() 0 3 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\Commands;
11
12
/**
13
 * Ping command.
14
 * @internal
15
 */
16
class PingCommand implements CommandInterface {
17
    use \Evenement\EventEmitterTrait;
18
    
19
    /**
20
     * The identifier for this command.
21
     * @var int
22
     * @source
23
     */
24
    const COMMAND_ID = 0x0E;
25
    
26
    /**
27
     * @var bool
28
     */
29
    protected $finished = false;
30
    
31
    /**
32
     * Get the encoded message for writing to the database connection.
33
     * @return string
34
     */
35 4
    function getEncodedMessage(): string {
36 4
        $this->finished = true;
37 4
        return \chr(static::COMMAND_ID);
38
    }
39
    
40
    /**
41
     * Sets the parser state, if necessary. If not, return `-1`.
42
     * @return int
43
     */
44 4
    function setParserState(): int {
45 4
        return -1;
46
    }
47
    
48
    /**
49
     * Sets the command as completed. This state gets reported back to the user.
50
     * @return void
51
     */
52 3
    function onComplete(): void {
53 3
        $this->finished = true;
54 3
        $this->emit('end');
55 3
    }
56
    
57
    /**
58
     * Sets the command as errored. This state gets reported back to the user.
59
     * @param \Throwable  $throwable
60
     * @return void
61
     */
62
    function onError(\Throwable $throwable): void {
63
        $this->finished = true;
64
        $this->emit('error', array($throwable));
65
    }
66
    
67
    /**
68
     * Sends the next received value into the command.
69
     * @param mixed  $value
70
     * @return void
71
     */
72
    function onNext($value): void {
73
        // Nothing to do
74
    }
75
    
76
    /**
77
     * Whether the command has finished.
78
     * @return bool
79
     */
80 3
    function hasFinished(): bool {
81 3
        return $this->finished;
82
    }
83
    
84
    /**
85
     * Whether this command sets the connection as busy.
86
     * @return bool
87
     */
88 4
    function waitForCompletion(): bool {
89 4
        return true;
90
    }
91
    
92
    /**
93
     * Whether the sequence ID should be resetted.
94
     * @return bool
95
     */
96 4
    function resetSequence(): bool {
97 4
        return true;
98
    }
99
}
100