1 | <?php |
||
29 | class PathPrefixer |
||
30 | { |
||
31 | |||
32 | /** |
||
33 | * @var string |
||
34 | */ |
||
35 | public $root_path; |
||
36 | |||
37 | |||
38 | /** |
||
39 | * @var string |
||
40 | */ |
||
41 | public $separator; |
||
42 | |||
43 | |||
44 | /** |
||
45 | * @param string $root_path Path to root directory; default: null (or getcwd(), respectively) |
||
46 | * @param string $separator String separator for prefix and path. |
||
47 | * When not set, DIRECTORY_SEPARATOR will be used. |
||
48 | */ |
||
49 | 65 | public function __construct( $root_path = null, $separator = \DIRECTORY_SEPARATOR) |
|
54 | |||
55 | |||
56 | /** |
||
57 | * Prepends a path prefix to the path given. |
||
58 | * |
||
59 | * @param mixed $path Path string ar array |
||
60 | * @return mixed Path string ar array with root path prepended |
||
61 | */ |
||
62 | 65 | public function __invoke( $path ) |
|
83 | } |
||
84 |