Completed
Push — master ( 5bc8c9...07e638 )
by Morris
52:34 queued 36:57
created

User   A

Complexity

Total Complexity 15

Size/Duplication

Total Lines 112
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 112
rs 10
c 0
b 0
f 0
wmc 15
lcom 1
cbo 0

14 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getUserId() 0 3 1
A getEmail() 0 3 1
A getDisplayName() 0 3 1
A getPhone() 0 3 1
A getAddress() 0 3 1
A getWebsite() 0 3 1
A getTwitter() 0 3 2
A getGroups() 0 3 1
A getLanguage() 0 3 1
A getUsedSpace() 0 3 1
A getFreeSpace() 0 3 1
A getTotalSpace() 0 3 1
A getQuota() 0 3 1
1
<?php
2
/**
3
 * @copyright Copyright (c) 2017 Robin Appelman <[email protected]>
4
 *
5
 * @license GNU AGPL version 3 or any later version
6
 *
7
 * This program is free software: you can redistribute it and/or modify
8
 * it under the terms of the GNU Affero General Public License as
9
 * published by the Free Software Foundation, either version 3 of the
10
 * License, or (at your option) any later version.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 * GNU Affero General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Affero General Public License
18
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
 *
20
 */
21
22
namespace OC\Remote;
23
24
25
use OCP\Remote\IUser;
26
27
class User implements IUser {
28
	const EXPECTED_KEYS = [
29
		'id',
30
		'email',
31
		'displayname',
32
		'phone',
33
		'address',
34
		'website',
35
		'groups',
36
		'language',
37
		'quota'
38
	];
39
40
	/** @var array */
41
	private $data;
42
43
	public function __construct(array $data) {
44
		$this->data = $data;
45
	}
46
47
48
	/**
49
	 * @return string
50
	 */
51
	public function getUserId() {
52
		return $this->data['id'];
53
	}
54
55
	/**
56
	 * @return string
57
	 */
58
	public function getEmail() {
59
		return $this->data['email'];
60
	}
61
62
	/**
63
	 * @return string
64
	 */
65
	public function getDisplayName() {
66
		return $this->data['displayname'];
67
	}
68
69
	/**
70
	 * @return string
71
	 */
72
	public function getPhone() {
73
		return $this->data['phone'];
74
	}
75
76
	/**
77
	 * @return string
78
	 */
79
	public function getAddress() {
80
		return $this->data['address'];
81
	}
82
83
	/**
84
	 * @return string
85
	 */
86
	public function getWebsite() {
87
		return $this->data['website'];
88
	}
89
90
	/**
91
	 * @return string
92
	 */
93
	public function getTwitter() {
94
		return isset($this->data['twitter']) ? $this->data['twitter'] : '';
95
	}
96
97
	/**
98
	 * @return string[]
99
	 */
100
	public function getGroups() {
101
		return $this->data['groups'];
102
	}
103
104
	/**
105
	 * @return string
106
	 */
107
	public function getLanguage() {
108
		return $this->data['language'];
109
	}
110
111
	/**
112
	 * @return int
113
	 */
114
	public function getUsedSpace() {
115
		return $this->data['quota']['used'];
116
	}
117
118
	/**
119
	 * @return int
120
	 */
121
	public function getFreeSpace() {
122
		return $this->data['quota']['free'];
123
	}
124
125
	/**
126
	 * @return int
127
	 */
128
	public function getTotalSpace() {
129
		return $this->data['quota']['total'];
130
	}
131
132
	/**
133
	 * @return int
134
	 */
135
	public function getQuota() {
136
		return $this->data['quota']['quota'];
137
	}
138
}
139