protected function JsonQueryMapQueryProvider::discoverQueryMaps in GraphQL 8.3
Discovers the available query maps within the configured lookup paths.
Return value
array An associative array of query maps with the query map versions as keys.
1 call to JsonQueryMapQueryProvider::discoverQueryMaps()
- JsonQueryMapQueryProvider::getQuery in src/
GraphQL/ QueryProvider/ JsonQueryMapQueryProvider.php - Returns a query string given the query parameters.
File
- src/
GraphQL/ QueryProvider/ JsonQueryMapQueryProvider.php, line 70
Class
Namespace
Drupal\graphql\GraphQL\QueryProviderCode
protected function discoverQueryMaps() {
$maps = [];
foreach ($this->lookupPaths as $path) {
if (is_dir($path)) {
$iterator = new RegexDirectoryIterator($path, '/\\.json/i');
/** @var \SplFileInfo $file */
foreach ($iterator as $file) {
$hash = sha1(file_get_contents($file
->getPathname()));
$maps[$hash] = $file
->getPathname();
}
}
if (is_file($path)) {
$file = new \SplFileInfo($path);
$hash = sha1(file_get_contents($file
->getPathname()));
$maps[$hash] = $file
->getPathname();
}
}
return $maps;
}