Response   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 7
c 2
b 0
f 1
dl 0
loc 32
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A id() 0 3 1
A json_handle() 0 10 2
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