Response::__set()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 5
c 0
b 0
f 0
ccs 5
cts 5
cp 1
rs 9.4285
cc 2
eloc 3
nc 2
nop 2
crap 2
1
<?php
2
/**
3
 * Copyright (c) Padosoft.com 2016.
4
 */
5
6
namespace Padosoft\HTTPClient;
7
8
/**
9
 * Class Response
10
 * Wrap psr7 Response object wit body and status code.
11
 * @package Padosoft\HTTPClient
12
 */
13
class Response
14
{
15
    /**
16
     * @var int
17
     */
18
    protected $status_code = -1;
19
    /**
20
     * @var string
21
     */
22
    protected $body = '';
23
    /**
24
     * @var \GuzzleHttp\Psr7\Response $psr7response
25
     */
26
    protected $psr7response;
27
28
    /**
29
     * @param $property
30
     * @return mixed
31
     */
32 9
    public function __get($property) {
33 9
        if (property_exists($this, $property)) {
34 9
            return $this->$property;
35
        }
36
    }
37
38
    /**
39
     * @param $property
40
     * @param $value
41
     */
42 9
    public function __set($property, $value) {
43 9
        if (property_exists($this, $property)) {
44 9
            $this->$property = $value;
45 9
        }
46 9
    }
47
48
49
}
50