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.

StatisticsCommand   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 81
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

8 Methods

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