Completed
Push — master ( 990277...5d19ef )
by Richard
02:52
created

FilePath::setBaseDir()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
namespace Transphporm;
3
4
class FilePath {
5
    private $baseDir;
6
    private $customBase;
7
8
    public function __construct($customBase = null) {
9
        $this->baseDir = "";
10
        if ($customBase === null) $this->customBase = getcwd();
11
        else $this->customBase = rtrim($customBase, '/');
12
    }
13
14
    public function setBaseDir($baseDir) {
15
        $this->baseDir = $baseDir;
16
    }
17
18
    public function getFilePath($filePath = "") {
19
		if (isset($filePath[0]) && $filePath[0] == "/") return $this->customBase . $filePath;
20
		else return $this->baseDir . $filePath;
21
	}
22
}
23