public function ExpiredCollector::collect in Simple OAuth (OAuth2) & OpenID Connect 8.2
Same name and namespace in other branches
- 8.4 src/ExpiredCollector.php \Drupal\simple_oauth\ExpiredCollector::collect()
- 8.3 src/ExpiredCollector.php \Drupal\simple_oauth\ExpiredCollector::collect()
- 5.x src/ExpiredCollector.php \Drupal\simple_oauth\ExpiredCollector::collect()
Collect all expired token ids.
Return value
\Drupal\simple_oauth\Entity\Oauth2TokenInterface[] The expired tokens.
File
- src/
ExpiredCollector.php, line 51
Class
- ExpiredCollector
- Service in charge of deleting or expiring tokens that cannot be used anymore.
Namespace
Drupal\simple_oauthCode
public function collect() {
$query = $this->tokenStorage
->getQuery();
$query
->condition('expire', $this->dateTime
->getRequestTime(), '<');
if (!($results = $query
->execute())) {
return [];
}
return array_values($this->tokenStorage
->loadMultiple(array_values($results)));
}