*/ abstract class BaseProvidersServiceFactory implements FactoryInterface { const PROVIDER_SETTING = 'providers'; /** * {@inheritDoc} * * @return array */ public function createService(ServiceLocatorInterface $serviceLocator) { $config = $serviceLocator->get('BjyAuthorize\Config'); $providers = array(); foreach ($config[static::PROVIDER_SETTING] as $providerName => $providerConfig) { if ($serviceLocator->has($providerName)) { $providers[] = $serviceLocator->get($providerName); } else { $providers[] = new $providerName($providerConfig, $serviceLocator); } } return $providers; } }