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

FilePath::getFilePath()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 3
eloc 3
nc 2
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