Completed
Push — master ( 89bfcf...4ab803 )
by Vladimir
02:41
created

FilePath   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 0
dl 0
loc 16
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A __toString() 0 4 1
1
<?php
2
3
/**
4
 * @copyright 2017 Vladimir Jimenez
5
 * @license   https://github.com/allejo/stakx/blob/master/LICENSE.md MIT
6
 */
7
8
namespace allejo\stakx\System;
9
10
/**
11
 * An object that will accept a *nix style path and return a cross-platform ready file path.
12
 */
13
class FilePath
14
{
15
    private $originalPath;
16
    private $pathNodes;
17
18
    public function __construct($filePath)
19
    {
20
        $this->originalPath = $filePath;
21
        $this->pathNodes = explode('/', $filePath);
22
    }
23
24
    public function __toString()
25
    {
26
        return implode(DIRECTORY_SEPARATOR, $this->pathNodes);
27
    }
28
}
29