autowp/external-login-service

View on GitHub
src/PluginManager.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php
 
declare(strict_types=1);
 
namespace Autowp\ExternalLoginService;
 
use Interop\Container\Exception\ContainerException;
use Laminas\ServiceManager\AbstractPluginManager;
use Laminas\ServiceManager\Exception\InvalidServiceException;
 
use function get_class;
use function gettype;
use function is_object;
use function sprintf;
 
class PluginManager extends AbstractPluginManager
{
Possibly zero references to protected property `\Autowp\ExternalLoginService\PluginManager->aliases`
protected $aliases = [
'facebook' => Facebook::class,
'github' => Github::class,
'google-plus' => GooglePlus::class,
'googleplus' => GooglePlus::class,
'google' => Google::class,
'linkedin' => Linkedin::class,
'linked-in' => Linkedin::class,
'twitter' => Twitter::class,
'vk' => Vk::class,
];
 
Possibly zero references to protected property `\Autowp\ExternalLoginService\PluginManager->factories`
protected $factories = [
Facebook::class => LoginServiceFactory::class,
Github::class => LoginServiceFactory::class,
GooglePlus::class => LoginServiceFactory::class,
Google::class => LoginServiceFactory::class,
Linkedin::class => LoginServiceFactory::class,
Twitter::class => LoginServiceFactory::class,
Vk::class => LoginServiceFactory::class,
];
 
/**
* Default instance type
*
* @var string
*/
Possibly zero write references to protected property `\Autowp\ExternalLoginService\PluginManager->instanceOf`
protected $instanceOf = AbstractService::class;
 
/**
* Validate an instance
*
* @param object $plugin
* @throws InvalidServiceException If created instance does not respect the.
* constraint on type imposed by the plugin manager.
* @throws ContainerException If any other error occurs.
*/
Possibly zero references to public method `\Autowp\ExternalLoginService\PluginManager::validate()`
public function validate($plugin)
{
if (! $plugin instanceof $this->instanceOf) {
throw new InvalidServiceException(sprintf(
'%s expects only to create instances of %s; %s is invalid',
static::class,
$this->instanceOf,
is_object($plugin) ? get_class($plugin) : gettype($plugin)
));
}
}
}