Request::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 7
nc 2
nop 5
dl 0
loc 10
ccs 0
cts 0
cp 0
crap 6
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Qiniu\Http;
3
4
final class Request
5
{
6
    /**
7
     * @var string
8
     */
9
    public $url;
10
11 102
    /**
12
     * @var array<string, string>
13 102
     */
14 102
    public $headers;
15 102
16 102
    /**
17 102
     * @var mixed|null
18
     */
19
    public $body;
20
21
    /**
22
     * @var string
23
     */
24
    public $method;
25
26
    /**
27
     * @var RequestOptions
28
     */
29
    public $opt;
30
31
    public function __construct($method, $url, array $headers = array(), $body = null, $opt = null)
32
    {
33
        $this->method = strtoupper($method);
34
        $this->url = $url;
35
        $this->headers = $headers;
36
        $this->body = $body;
37
        if ($opt === null) {
38
            $opt = new RequestOptions();
39
        }
40
        $this->opt = $opt;
41
    }
42
}
43