AuthenticationCollector.php in Drupal 8
File
core/lib/Drupal/Core/Authentication/AuthenticationCollector.php
View source
<?php
namespace Drupal\Core\Authentication;
class AuthenticationCollector implements AuthenticationCollectorInterface {
protected $providers;
protected $providerOrders = [];
protected $sortedProviders;
protected $globalProviders;
public function addProvider(AuthenticationProviderInterface $provider, $provider_id, $priority = 0, $global = FALSE) {
$this->providers[$provider_id] = $provider;
$this->providerOrders[$priority][$provider_id] = $provider;
$this->sortedProviders = NULL;
if ($global) {
$this->globalProviders[$provider_id] = TRUE;
}
}
public function isGlobal($provider_id) {
return isset($this->globalProviders[$provider_id]);
}
public function getProvider($provider_id) {
return isset($this->providers[$provider_id]) ? $this->providers[$provider_id] : NULL;
}
public function getSortedProviders() {
if (!isset($this->sortedProviders)) {
krsort($this->providerOrders);
$this->sortedProviders = [];
foreach ($this->providerOrders as $providers) {
$this->sortedProviders = array_merge($this->sortedProviders, $providers);
}
}
return $this->sortedProviders;
}
}