Completed
Push — master ( 4a5a36...bf8806 )
by Robin
27s
created

CloudId::getUser()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
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 code is free software: you can redistribute it and/or modify
8
 * it under the terms of the GNU Affero General Public License, version 3,
9
 * as published by the Free Software Foundation.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
 * GNU Affero General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Affero General Public License, version 3,
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
18
 *
19
 */
20
21
namespace OC\Federation;
22
23
use OCP\Federation\ICloudId;
24
25
class CloudId implements ICloudId {
26
	/** @var string */
27
	private $id;
28
	/** @var string */
29
	private $user;
30
	/** @var string */
31
	private $remote;
32
33
	/**
34
	 * CloudId constructor.
35
	 *
36
	 * @param string $id
37
	 * @param string $user
38
	 * @param string $remote
39
	 */
40
	public function __construct($id, $user, $remote) {
41
		$this->id = $id;
42
		$this->user = $user;
43
		$this->remote = $remote;
44
	}
45
46
	/**
47
	 * The full remote cloud id
48
	 *
49
	 * @return string
50
	 */
51
	public function getId() {
52
		return $this->id;
53
	}
54
55
	public function getDisplayId() {
56
		return str_replace('https://', '', str_replace('http://', '', $this->getId()));
57
	}
58
59
	/**
60
	 * The username on the remote server
61
	 *
62
	 * @return string
63
	 */
64
	public function getUser() {
65
		return $this->user;
66
	}
67
68
	/**
69
	 * The base address of the remote server
70
	 *
71
	 * @return string
72
	 */
73
	public function getRemote() {
74
		return $this->remote;
75
	}
76
}
77