ServerRequest::getServerParams()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace hiapi\console;
4
5
use Psr\Http\Message\ServerRequestInterface;
6
use Psr\Http\Message\UriInterface;
7
use Psr\Http\Message\StreamInterface;
8
9
/**
10
 * PSR-7 compatible console ServerRequest
11
 *
12
 * XXX
13
 * XXX NOT finished, NOT used
14
 * XXX
15
 * @
16
 * @author Andrii Vasyliev <[email protected]>
17
 */
18
class ServerRequest implements ServerRequestInterface
19
{
20
21
    protected $route;
22
23
    protected $params;
24
25
    public function getQueryParams()
26
    {
27
        if ($this->params === null) {
28
            $this->params = $this->parseParams();
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $this->params is correct as $this->parseParams() (which targets hiapi\console\ServerRequest::parseParams()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
29
        }
30
31
        return $this->params;
32
    }
33
34
    protected function parseParams()
35
    {
36
        if (isset($_SERVER['argv'])) {
37
            $args = $_SERVER['argv'];
38
            array_shift($this->_params);
0 ignored issues
show
Bug introduced by
The property _params does not seem to exist. Did you mean params?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
39
        } else {
40
            $args = [];
41
        }
42
        foreach ($args as $arg) {
43
            var_dump($arg);
0 ignored issues
show
Security Debugging Code introduced by
var_dump($arg); looks like debug code. Are you sure you do not want to remove it? This might expose sensitive data.
Loading history...
44
        }
45
        die;
46
    }
47
48
    public function getParsedBody()
49
    {
50
        return [];
51
    }
52
53
    public function getServerParams()
54
    {
55
        throw new \Exception('not implemented');
56
    }
57
58
    public function getCookieParams()
59
    {
60
        throw new \Exception('not implemented');
61
    }
62
63
    public function withCookieParams(array $cookies)
64
    {
65
        throw new \Exception('not implemented');
66
    }
67
68
    public function withQueryParams(array $query)
69
    {
70
        throw new \Exception('not implemented');
71
    }
72
73
    public function getUploadedFiles()
74
    {
75
        throw new \Exception('not implemented');
76
    }
77
78
    public function withUploadedFiles(array $uploadedFiles)
79
    {
80
        throw new \Exception('not implemented');
81
    }
82
83
    public function withParsedBody($data)
84
    {
85
        throw new \Exception('not implemented');
86
    }
87
88
    public function getAttributes()
89
    {
90
        throw new \Exception('not implemented');
91
    }
92
93
    public function getAttribute($name, $default = null)
94
    {
95
        throw new \Exception('not implemented');
96
    }
97
98
    public function withAttribute($name, $value)
99
    {
100
        throw new \Exception('not implemented');
101
    }
102
103
    public function withoutAttribute($name)
104
    {
105
        throw new \Exception('not implemented');
106
    }
107
108
    public function getRequestTarget()
109
    {
110
        throw new \Exception('not implemented');
111
    }
112
113
    public function withRequestTarget($requestTarget)
114
    {
115
        throw new \Exception('not implemented');
116
    }
117
118
    public function getMethod()
119
    {
120
        throw new \Exception('not implemented');
121
    }
122
123
    public function withMethod($method)
124
    {
125
        throw new \Exception('not implemented');
126
    }
127
128
    public function getUri()
129
    {
130
        throw new \Exception('not implemented');
131
    }
132
133
    public function withUri(UriInterface $uri, $preserveHost = false)
134
    {
135
        throw new \Exception('not implemented');
136
    }
137
138
    public function getProtocolVersion()
139
    {
140
        throw new \Exception('not implemented');
141
    }
142
143
    public function withProtocolVersion($version)
144
    {
145
        throw new \Exception('not implemented');
146
    }
147
148
    public function getHeaders()
149
    {
150
        throw new \Exception('not implemented');
151
    }
152
153
    public function hasHeader($name)
154
    {
155
        throw new \Exception('not implemented');
156
    }
157
158
    public function getHeader($name)
159
    {
160
        throw new \Exception('not implemented');
161
    }
162
163
    public function getHeaderLine($name)
164
    {
165
        throw new \Exception('not implemented');
166
    }
167
168
    public function withHeader($name, $value)
169
    {
170
        throw new \Exception('not implemented');
171
    }
172
173
    public function withAddedHeader($name, $value)
174
    {
175
        throw new \Exception('not implemented');
176
    }
177
178
    public function withoutHeader($name)
179
    {
180
        throw new \Exception('not implemented');
181
    }
182
183
    public function getBody()
184
    {
185
        throw new \Exception('not implemented');
186
    }
187
188
    public function withBody(StreamInterface $body)
189
    {
190
        throw new \Exception('not implemented');
191
    }
192
}
193