Completed
Push — master ( 1f0278...22c246 )
by
unknown
12s
created

Keys   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 63
rs 10
c 0
b 0
f 0
wmc 5
lcom 1
cbo 1

5 Methods

Rating   Name   Duplication   Size   Complexity  
A initialize() 0 4 1
A populate() 0 10 1
A getEncryption() 0 4 1
A getBasicAuth() 0 4 1
A get() 0 4 1
1
<?php
2
3
namespace Moip\Resource;
4
5
use stdClass;
6
7
/**
8
 * Class Keys.
9
 */
10
class Keys extends MoipResource
11
{
12
    /**
13
     * @const string
14
     */
15
    const PATH = 'keys';
16
17
    /**
18
     * Initializes new instances.
19
     */
20
    public function initialize()
21
    {
22
        $this->data = new stdClass();
23
    }
24
25
    /**
26
     * Mount keys structure.
27
     *
28
     * @param \stdClass $response
29
     *
30
     * @return $this
31
     */
32
    protected function populate(stdClass $response)
33
    {
34
        $keys = clone $this;
35
36
        $resp = $response->keys;
37
        $keys->data->basicAuth = $this->getIfSet('basicAuth', $resp);
38
        $keys->data->encryption = $this->getIfSet('encryption', $resp);
39
40
        return $keys;
41
    }
42
43
    /**
44
     * Get encryption.
45
     *
46
     * @return string
47
     */
48
    public function getEncryption()
49
    {
50
        return $this->getIfSet('encryption');
51
    }
52
53
    /**
54
     * Get Basic Auth.
55
     *
56
     * @return stdClass
57
     */
58
    public function getBasicAuth()
59
    {
60
        return $this->getIfSet('basicAuth');
61
    }
62
63
    /**
64
     * Get keys.
65
     *
66
     * @return stdClass
67
     */
68
    public function get()
69
    {
70
        return $this->getByPath(sprintf('/%s/%s', MoipResource::VERSION, self::PATH));
71
    }
72
}
73