Completed
Push — master ( b7d668...770957 )
by Gallice
02:33
created

BufferUser   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 53
ccs 9
cts 9
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getId() 0 4 1
A getName() 0 4 1
A toArray() 0 4 1
1
<?php
2
3
namespace Tgallice\OAuth2\Client\Provider;
4
5
use League\OAuth2\Client\Provider\ResourceOwnerInterface;
6
7
class BufferUser implements ResourceOwnerInterface
8
{
9
    /**
10
     * @var array
11
     */
12
    private $response;
13
14
    /**
15
     * @var array
16
     */
17
    private $defaultFields = array(
18
        'id' => null,
19
        'name' => null,
20
    );
21
22
    /**
23
     * @param array $response
24
     */
25 2
    public function __construct(array $response = array())
26
    {
27 2
        $this->response = array_merge($this->defaultFields, $response);
28 2
    }
29
30
    /**
31
     * Get the ID for the user
32
     *
33
     * @return string|null
34
     */
35 2
    public function getId()
36
    {
37 2
        return $this->response['id'];
38
    }
39
40
    /**
41
     * Get the name for the user
42
     *
43
     * @return string|null
44
     */
45 2
    public function getName()
46
    {
47 2
        return $this->response['name'];
48
    }
49
50
    /**
51
     * Return all the data for the user
52
     *
53
     * @return array
54
     */
55 2
    public function toArray()
56
    {
57 2
        return $this->response;
58
    }
59
}
60