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[] |
||
95 | */ |
||
96 | public function find($siteName) |
||
100 | |||
101 | /** |
||
102 | * Find an alias file SITENAME.site.yml in one |
||
103 | * of the specified search locations. |
||
104 | * |
||
105 | * @param string $siteName |
||
106 | * @return string|bool |
||
107 | */ |
||
108 | public function findSingleSiteAliasFile($siteName) |
||
116 | |||
117 | /** |
||
118 | * Return a list of all SITENAME.site.yml files in any of |
||
119 | * the search locations. |
||
120 | * |
||
121 | * @return string[] |
||
122 | */ |
||
123 | public function findAllSingleAliasFiles() |
||
127 | |||
128 | /** |
||
129 | * Return all of the legacy alias files used in previous Drush versions. |
||
130 | * |
||
131 | * @return string[] |
||
132 | */ |
||
133 | public function findAllLegacyAliasFiles() |
||
140 | |||
141 | /** |
||
142 | * Create a Symfony Finder object to search all available search locations |
||
143 | * for the specified search pattern. |
||
144 | * |
||
145 | * @param string $searchPattern |
||
146 | * @return Finder |
||
147 | */ |
||
148 | protected function createFinder($searchPattern) |
||
157 | |||
158 | /** |
||
159 | * Return a list of all alias files matching the provided pattern. |
||
160 | * |
||
161 | * @param string $searchPattern |
||
162 | * @return string[] |
||
163 | */ |
||
164 | protected function searchForAliasFiles($searchPattern) |
||
185 | |||
186 | // TODO: Seems like this could just be basename() |
||
187 | protected function extractKey($basename, $filenameExensions) |
||
191 | } |
||
192 |