Passed
Pull Request — master (#24)
by frey
09:24
created

RequestInternal::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 6
c 1
b 0
f 0
nc 2
nop 4
dl 0
loc 9
ccs 0
cts 9
cp 0
crap 6
rs 10
1
<?php
2
3
namespace Freyo\LaravelQueueCMQ\Queue\Driver;
4
5
class RequestInternal
6
{
7
    public $header;
8
    public $method;
9
    public $uri;
10
    public $data;
11
12
    public function __construct($method = '', $uri = '', $header = null, $data = '')
13
    {
14
        if ($header == null) {
15
            $header = [];
16
        }
17
        $this->method = $method;
18
        $this->uri = $uri;
19
        $this->header = $header;
20
        $this->data = $data;
21
    }
22
23
    public function __toString()
24
    {
25
        $info = ['method'      => $this->method,
26
                      'uri'    => $this->uri,
27
                      'header' => json_encode($this->header),
28
                      'data'   => $this->data, ];
29
30
        return json_encode($info);
31
    }
32
}
33