Passed
Push — master ( 419110...a41d9b )
by Dmitry
02:04
created

Response::__construct()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 1
nop 1
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace UAPAY\Sessions\Create;
4
5
use UAPAY\Log as Log;
6
use UAPAY\Exception;
7
8
class Response extends \UAPAY\Response
9
{
10
    /**
11
     *      @var string
12
     */
13
    protected $id;
14
15
    /**
16
     *      Handle decoded JSON
17
     *
18
     *      @throws Exception\JSON
19
     */
20
    public function json_handle()
21
    {
22
        parent::json_handle();
23
24
        if (!isset($this->json['data']['id']))
25
        {
26
            throw new Exception\JSON('data does not contain the id field!');
27
        }
28
29
        $this->id = $this->json['data']['id'];
30
    }
31
32
    /**
33
     *      Get session id
34
     *
35
     *      @return string id session
36
     */
37
    public function id()
38
    {
39
            return $this->id;
40
    }
41
}
42