AbstractResponse::getInformation()   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
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Igorsgm\TibiaDataApi\Response;
4
5
use Carbon\Carbon;
6
use Igorsgm\TibiaDataApi\Models\Information;
7
8
/**
9
 * Class AbstractResponse
10
 * @package Igorsgm\TibiaDataApi\Response
11
 */
12
class AbstractResponse
13
{
14
    /**
15
     * @var Information
16
     */
17
    private $information;
18
19
    /**
20
     * AbstractResponse constructor.
21
     * @param  \stdClass  $response
22
     * @throws \Igorsgm\TibiaDataApi\Exceptions\ImmutableException
23
     * @throws \Exception
24
     */
25
    public function __construct(\stdClass $response)
26
    {
27
        $this->information = new Information(
28
            $response->information->api_version,
29
            $response->information->execution_time,
30
            new Carbon($response->information->last_updated),
31
            new Carbon($response->information->timestamp)
32
        );
33
    }
34
35
    /**
36
     * @return Information
37
     */
38
    public function getInformation(): Information
39
    {
40
        return $this->information;
41
    }
42
}
43