public static function Base::getMethods in DRD Agent 8.3
Same name in this branch
- 8.3 src/Crypt/Base.php \Drupal\drd_agent\Crypt\Base::getMethods()
- 8.3 src/Agent/Auth/Base.php \Drupal\drd_agent\Agent\Auth\Base::getMethods()
Same name and namespace in other branches
- 4.0.x src/Crypt/Base.php \Drupal\drd_agent\Crypt\Base::getMethods()
Get a list of crypt methods, either just their ids or instances of each.
Parameters
\Symfony\Component\DependencyInjection\ContainerInterface $container:
bool $instances: Whether to receive ids (FALSE) or instances (TRUE).
Return value
array List of crypt methods.
Overrides BaseInterface::getMethods
1 call to Base::getMethods()
- Agent::getCryptMethods in src/
Controller/ Agent.php - Route callback to retrieve a list of available crypt methods.
File
- src/
Crypt/ Base.php, line 25
Class
- Base
- Provides base encryption functionality.
Namespace
Drupal\drd_agent\CryptCode
public static function getMethods(ContainerInterface $container, $instances = FALSE) : array {
$methods = [];
foreach ([
'MCrypt',
'OpenSSL',
'TLS',
] as $item) {
$classname = "\\Drupal\\drd_agent\\Crypt\\Method\\{$item}";
/* @var BaseMethodInterface $method */
$method = new $classname($container);
if ($method instanceof BaseMethodInterface && $method
->isAvailable()) {
if ($instances) {
$methods[$method
->getLabel()] = $method;
}
else {
$methods[$method
->getLabel()] = [
'classname' => $classname,
'cipher' => $method
->getCipherMethods(),
];
}
}
}
return $methods;
}