PosixPathBuilder   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getPermutations() 0 4 1
1
<?php
2
namespace Nubs\Which\PathBuilder;
3
4
/**
5
 * A path builder for building paths to commands on POSIXy systems (e.g., Linux,
6
 * OSX, BSD).
7
 */
8
class PosixPathBuilder implements PathBuilderInterface
9
{
10
    use PosixFileAppenderTrait;
11
12
    /** @type array The base paths for files. */
13
    private $_paths;
14
15
    /**
16
     * Initialize the path builder.
17
     *
18
     * @param array $paths The base paths for files.
19
     */ 
20
    public function __construct(array $paths)
21
    {
22
        $this->_paths = array_values(array_unique($paths));
23
    }
24
25
    /**
26
     * Gets the permutations of paths to the given file.
27
     *
28
     * @param string $file The file to build paths to.
29
     * @return array The permutations of file paths.
30
     */
31
    public function getPermutations($file)
32
    {
33
        return $this->_appendFileToPaths($this->_paths, $file);
34
    }
35
}
36