Response::json_handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
c 0
b 0
f 0
nc 2
nop 0
dl 0
loc 10
rs 10
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
    protected 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