Response::id()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
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