1 | <?php |
||
23 | class SiteAliasFileDiscovery |
||
24 | { |
||
25 | protected $searchLocations; |
||
26 | protected $locationFilter; |
||
27 | protected $depth; |
||
28 | |||
29 | public function __construct($searchLocations = [], $depth = '<= 1', $locationFilter = null) |
||
35 | |||
36 | /** |
||
37 | * Add a location that alias files may be found. |
||
38 | * |
||
39 | * @param string $path |
||
40 | * @return $this |
||
41 | */ |
||
42 | public function addSearchLocation($path) |
||
49 | |||
50 | /** |
||
51 | * Return all of the paths where alias files may be found. |
||
52 | * @return string[] |
||
53 | */ |
||
54 | public function searchLocations() |
||
58 | |||
59 | public function locationFilter() |
||
63 | |||
64 | /** |
||
65 | * Set the search depth for finding alias files |
||
66 | * |
||
67 | * @param string|int $depth (@see \Symfony\Component\Finder\Finder::depth) |
||
68 | * @return $this |
||
69 | */ |
||
70 | public function depth($depth) |
||
75 | |||
76 | /** |
||
77 | * Only search for aliases that are in alias files stored in directories |
||
78 | * whose basename or key matches the specified location. |
||
79 | */ |
||
80 | public function filterByLocation($location) |
||
88 | |||
89 | /** |
||
90 | * Find an alias file SITENAME.site.yml in one |
||
91 | * of the specified search locations. |
||
92 | * |
||
93 | * @param string $siteName |
||
94 | * @return string|bool |
||
95 | */ |
||
96 | public function findSingleSiteAliasFile($siteName) |
||
104 | |||
105 | /** |
||
106 | * Return a list of all SITENAME.site.yml files in any of |
||
107 | * the search locations. |
||
108 | * |
||
109 | * @return string[] |
||
110 | */ |
||
111 | public function findAllSingleAliasFiles() |
||
115 | |||
116 | /** |
||
117 | * Return all of the legacy alias files used in previous Drush versions. |
||
118 | * |
||
119 | * @return string[] |
||
120 | */ |
||
121 | public function findAllLegacyAliasFiles() |
||
128 | |||
129 | /** |
||
130 | * Create a Symfony Finder object to search all available search locations |
||
131 | * for the specified search pattern. |
||
132 | * |
||
133 | * @param string $searchPattern |
||
134 | * @return Finder |
||
135 | */ |
||
136 | protected function createFinder($searchPattern) |
||
145 | |||
146 | /** |
||
147 | * Return a list of all alias files matching the provided pattern. |
||
148 | * |
||
149 | * @param string $searchPattern |
||
150 | * @return string[] |
||
151 | */ |
||
152 | protected function searchForAliasFiles($searchPattern) |
||
172 | |||
173 | /** |
||
174 | * Return a list of all alias files with the specified extension. |
||
175 | * |
||
176 | * @param string $filenameExensions |
||
177 | * @return string[] |
||
178 | */ |
||
179 | protected function searchForAliasFilesKeyedByBasenamePrefix($filenameExensions) |
||
194 | |||
195 | // TODO: Seems like this could just be basename() |
||
196 | protected function extractKey($basename, $filenameExensions) |
||
200 | } |
||
201 |