1 | <?php |
||
15 | class FileLocator implements LocatorInterface |
||
16 | { |
||
17 | /** |
||
18 | * Search for a file in one or more directories. |
||
19 | * @var array |
||
20 | */ |
||
21 | protected $paths; |
||
22 | |||
23 | /** |
||
24 | * File Locator creator. |
||
25 | * |
||
26 | * @param array|string $paths |
||
27 | * |
||
28 | * @return void |
||
|
|||
29 | */ |
||
30 | public function __construct($paths) |
||
34 | |||
35 | /** |
||
36 | * {@inheritdoc} |
||
37 | */ |
||
38 | public function locate($resource) |
||
57 | |||
58 | /** |
||
59 | * Adds a search paths. |
||
60 | * |
||
61 | * @param string|array $path or several paths |
||
62 | * |
||
63 | * @return void |
||
64 | */ |
||
65 | public function addPath($path) |
||
72 | |||
73 | /** |
||
74 | * Remove last search path. |
||
75 | * |
||
76 | * @return void |
||
77 | */ |
||
78 | public function popPath() |
||
82 | |||
83 | /** |
||
84 | * @deprecated Use unshiftPath() method |
||
85 | */ |
||
86 | public function prependPath($path) |
||
90 | |||
91 | /** |
||
92 | * Prepends one path to the beginning of the search paths. |
||
93 | * |
||
94 | * @param string $path |
||
95 | * |
||
96 | * @return void |
||
97 | */ |
||
98 | public function unshiftPath($path) |
||
102 | |||
103 | /** |
||
104 | * Remove first path from the search paths. |
||
105 | * |
||
106 | * @return void |
||
107 | */ |
||
108 | public function shiftPath() |
||
112 | |||
113 | /** |
||
114 | * Returns all registered search paths. |
||
115 | * |
||
116 | * @return array |
||
117 | */ |
||
118 | public function getPaths() |
||
122 | |||
123 | /** |
||
124 | * Check if the file/path is given with absolute path. |
||
125 | * |
||
126 | * @param string $path |
||
127 | * |
||
128 | * @return bool |
||
129 | */ |
||
130 | protected function isFullPath($path) |
||
144 | } |
||
145 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.