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.
Test Failed
Push — master ( 9c8b5e...1077ea )
by Charlotte
03:13
created

src/Commands/PrepareCommand.php (1 issue)

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\Commands;
11
12
/**
13
 * Prepare command.
14
 * @internal
15
 */
16
class PrepareCommand extends PromiseCommand {
17
    /**
18
     * The identifier for this command.
19
     * @var int
20
     * @source
21
     */
22
    const COMMAND_ID = 0x16;
23
    
24
    /**
25
     * @var \Plasma\ClientInterface
26
     */
27
    protected $client;
28
    
29
    /**
30
     * @var \Plasma\DriverInterface
31
     */
32
    protected $driver;
33
    
34
    /**
35
     * @var string
36
     */
37
    protected $query;
38
    
39
    /**
40
     * @var string
41
     */
42
    protected $rewrittenQuery;
43
    
44
    /**
45
     * @var array
46
     */
47
    protected $rewrittenParams;
48
    
49
    /**
50
     * @var \Plasma\Drivers\MySQL\Messages\PrepareStatementOkMessage
51
     */
52
    protected $okResponse;
53
    
54
    /**
55
     * @var \Plasma\ColumnDefinitionInterface[]
56
     */
57
    protected $params = array();
58
    
59
    /**
60
     * @var \Plasma\ColumnDefinitionInterface[]
61
     */
62
    protected $fields = array();
63
    
64
    /**
65
     * @var int
66
     */
67
    protected $fieldsCount;
68
    
69
    /**
70
     * @var \Plasma\StatementInterface|null
71
     */
72
    protected $resolveValue;
73
    
74
    /**
75
     * Constructor.
76
     * @param \Plasma\ClientInterface  $client
77
     * @param \Plasma\DriverInterface  $driver
78
     * @param string                   $query
79
     */
80 1
    function __construct(\Plasma\ClientInterface $client, \Plasma\DriverInterface $driver, string $query) {
81 1
        parent::__construct();
82
        
83 1
        $this->client = $client;
84 1
        $this->driver = $driver;
85 1
        $this->query = $query;
86
        
87 1
        [ 'query' => $this->rewrittenQuery, 'parameters' => $this->rewrittenParams ] = \Plasma\Utility::parseParameters($this->query, '?');
88 1
    }
89
    
90
    /**
91
     * Get the encoded message for writing to the database connection.
92
     * @return string
93
     */
94 1
    function getEncodedMessage(): string {
95 1
        return \chr(static::COMMAND_ID).$this->rewrittenQuery;
96
    }
97
    
98
    /**
99
     * Sends the next received value into the command.
100
     * @param mixed  $value
101
     * @return void
102
     * @throws \Plasma\Drivers\MySQL\Messages\ParseException
103
     */
104 1
    function onNext($value): void {
105 1
        var_dump($value); ob_flush();
0 ignored issues
show
Security Debugging Code introduced by
var_dump($value) looks like debug code. Are you sure you do not want to remove it?
Loading history...
106
        
107 1
        if($value instanceof \Plasma\Drivers\MySQL\Messages\PrepareStatementOkMessage) {
108 1
            $this->okResponse = $value;
109 1
            $this->fieldsCount = $this->okResponse->numColumns;
110 1
        } elseif($value instanceof \Plasma\Drivers\MySQL\ProtocolOnNextCaller) {
111 1
            $buffer = $value->getBuffer();
112 1
            $parser = $value->getParser();
113
            
114 1
            $parsed = $this->handleQueryOnNextCallerColumns($buffer, $parser);
115
            
116 1
            if($this->okResponse->numParams >= \count($this->params)) {
117 1
                $this->params[] = $parsed;
118 1
            } elseif($this->okResponse->numColumns >= \count($this->fields)) {
119 1
                $this->fields[$parsed->getName()] = $parsed;
120
            } else {
121
                throw new \Plasma\Drivers\MySQL\Messages\ParseException('Command received more column definition packets than defined');
122
            }
123
            
124 1
            $value->setBuffer($buffer);
125
        } elseif(
126
            $value instanceof \Plasma\Drivers\MySQL\Messages\EOFMessage || $value instanceof \Plasma\Drivers\MySQL\Messages\OkResponseMessage
127
        ) {
128
            $this->finished = true;
129
            
130
            $id = $this->okResponse->statementID;
131
            $queryr = $this->rewrittenQuery;
132
            $paramsr = $this->rewrittenParams;
133
            
134
            $this->resolveValue = new \Plasma\Drivers\MySQL\Statement($this->client, $this->driver, $id, $this->query, $queryr, $paramsr, $this->params, $this->fields);
135
            $this->deferred->resolve($this->resolveValue);
136
        } else {
137
            throw new \Plasma\Drivers\MySQL\Messages\ParseException('Command received value of type '
138
                .(\is_object($value) ? \get_class($value) : \gettype($value)).' it can not handle');
139
        }
140 1
    }
141
    
142
    /**
143
     * Whether the sequence ID should be resetted.
144
     * @return bool
145
     */
146 1
    function resetSequence(): bool {
147 1
        return true;
148
    }
149
}
150