Completed
Push — master ( f9d8eb...989a8a )
by Lukas
14:49
created

CachedMountFileInfo   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 21
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getInternalPath() 0 7 2
A getPath() 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\Files\Config;
23
24
25
use OCP\Files\Config\ICachedMountFileInfo;
26
use OCP\IUser;
27
28
class CachedMountFileInfo extends CachedMountInfo implements ICachedMountFileInfo {
29
	/** @var string */
30
	private $internalPath;
31
32
	public function __construct(IUser $user, $storageId, $rootId, $mountPoint, $mountId = null, $rootInternalPath = '', $internalPath) {
33
		parent::__construct($user, $storageId, $rootId, $mountPoint, $mountId, $rootInternalPath);
34
		$this->internalPath = $internalPath;
35
	}
36
37
	public function getInternalPath() {
38
		if ($this->getRootInternalPath()) {
39
			return substr($this->internalPath, strlen($this->getRootInternalPath()) + 1);
40
		} else {
41
			return $this->internalPath;
42
		}
43
	}
44
45
	public function getPath() {
46
		return $this->getMountPoint() . $this->getInternalPath();
47
	}
48
}