You are here

public function Server::getSortedPersistedQueryInstances in GraphQL 8.4

Returns the current persisted queries set, sorted by the plugins weight.

Return value

\Drupal\graphql\Plugin\PersistedQueryPluginInterface[]

Overrides ServerInterface::getSortedPersistedQueryInstances

1 call to Server::getSortedPersistedQueryInstances()
Server::getPersistedQueryLoader in src/Entity/Server.php
Returns a callable for loading persisted queries.

File

src/Entity/Server.php, line 431

Class

Server
The main GraphQL configuration and request entry point.

Namespace

Drupal\graphql\Entity

Code

public function getSortedPersistedQueryInstances() {
  if (!is_null($this->sorted_persisted_query_instances)) {
    return $this->sorted_persisted_query_instances;
  }
  $this->sorted_persisted_query_instances = $this
    ->getPersistedQueryInstances();
  if (!empty($this->sorted_persisted_query_instances)) {
    uasort($this->sorted_persisted_query_instances, function ($a, $b) {
      return $a
        ->getWeight() <= $b
        ->getWeight() ? -1 : 1;
    });
  }
  return $this->sorted_persisted_query_instances;
}