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

FilePath   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 19
rs 10
c 1
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 2
A setBaseDir() 0 3 1
A getFilePath() 0 4 3
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