X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fdrush%2Fdrush%2Fsrc%2FSiteAlias%2FSiteAliasFileDiscovery.php;fp=vendor%2Fdrush%2Fdrush%2Fsrc%2FSiteAlias%2FSiteAliasFileDiscovery.php;h=0000000000000000000000000000000000000000;hp=d41e2109ffeb2823eeed3b4d849cdb0ac4ca19c5;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/vendor/drush/drush/src/SiteAlias/SiteAliasFileDiscovery.php b/vendor/drush/drush/src/SiteAlias/SiteAliasFileDiscovery.php deleted file mode 100644 index d41e2109f..000000000 --- a/vendor/drush/drush/src/SiteAlias/SiteAliasFileDiscovery.php +++ /dev/null @@ -1,168 +0,0 @@ -searchLocations[] = $path; - } - return $this; - } - - /** - * Return all of the paths where alias files may be found. - * @return string[] - */ - public function searchLocations() - { - return $this->searchLocations; - } - - - /** - * Set the search depth for finding alias files - * - * @param string|int $depth (@see \Symfony\Component\Finder\Finder::depth) - * @return $this - */ - public function depth($depth) - { - $this->depth = $depth; - return $this; - } - - /** - * Find an alias file SITENAME.site.yml in one - * of the specified search locations. - * - * @param string $siteName - * @return string|bool - */ - public function findSingleSiteAliasFile($siteName) - { - $matches = $this->searchForAliasFiles("$siteName.site.yml"); - if (empty($matches)) { - return false; - } - return reset($matches); - } - - /** - * Return a list of all SITENAME.site.yml files in any of - * the search locations. - * - * @return string[] - */ - public function findAllSingleAliasFiles() - { - return $this->searchForAliasFiles('*.site.yml'); - } - - /** - * Return all of the legacy alias files used in previous Drush versions. - * - * @return string[] - */ - public function findAllLegacyAliasFiles() - { - return array_merge( - $this->searchForAliasFiles('*.alias.drushrc.php'), - $this->searchForAliasFiles('*.aliases.drushrc.php') - ); - } - - /** - * Create a Symfony Finder object to search all available search locations - * for the specified search pattern. - * - * @param string $searchPattern - * @return Finder - */ - protected function createFinder($searchPattern) - { - $finder = new Finder(); - $finder->files() - ->name($searchPattern) - ->in($this->searchLocations) - ->depth($this->depth); - return $finder; - } - - /** - * Return a list of all alias files matching the provided pattern. - * - * @param string $searchPattern - * @return string[] - */ - protected function searchForAliasFiles($searchPattern) - { - if (empty($this->searchLocations)) { - return []; - } - $finder = $this->createFinder($searchPattern); - $result = []; - foreach ($finder as $file) { - $path = $file->getRealPath(); - $result[] = $path; - } - return $result; - } - - /** - * Return a list of all alias files with the specified extension. - * - * @param string $filenameExensions - * @return string[] - */ - protected function searchForAliasFilesKeyedByBasenamePrefix($filenameExensions) - { - if (empty($this->searchLocations)) { - return []; - } - $searchPattern = '*' . $filenameExensions; - $finder = $this->createFinder($searchPattern); - $result = []; - foreach ($finder as $file) { - $path = $file->getRealPath(); - $key = $this->extractKey($file->getBasename(), $filenameExensions); - $result[$key] = $path; - } - return $result; - } - - // TODO: Seems like this could just be basename() - protected function extractKey($basename, $filenameExensions) - { - return str_replace($filenameExensions, '', $basename); - } -}