Passed
Push — master ( f2e76c...2ddbad )
by 世昌
03:02
created

Request   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 32
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getMethod() 0 3 1
1
<?php
2
namespace nebula\request;
3
4
use nebula\request\attribute\URIAttribute;
5
6
7
8
/**
9
 * HTTP请求解析器
10
 *
11
 */
12
class Request   {
13
14
    use URIAttribute;
15
    
16
    /**
17
     * 请求方法
18
     *
19
     * @var string
20
     */
21
    protected $method;
22
23
    /**
24
     * 请求头
25
     *
26
     * @var string
27
     */
28
    protected $headers;
29
30
    public function __construct(string $method, string $uri, array $headers = []) {
31
        $this->uri = $uri;
32
        $this->method = strtoupper($method);
33
        $this->headers = $headers;
0 ignored issues
show
Documentation Bug introduced by
It seems like $headers of type array is incompatible with the declared type string of property $headers.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
34
    }
35
36
    /**
37
     * Get 请求方法
38
     *
39
     * @return  string
40
     */ 
41
    public function getMethod()
42
    {
43
        return $this->method;
44
    }
45
}