public function CoreServiceProvider::alter in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/CoreServiceProvider.php \Drupal\Core\CoreServiceProvider::alter()
- 9 core/lib/Drupal/Core/CoreServiceProvider.php \Drupal\Core\CoreServiceProvider::alter()
Alters the UUID service to use the most efficient method available.
Parameters
\Drupal\Core\DependencyInjection\ContainerBuilder $container: The container builder.
File
- core/
lib/ Drupal/ Core/ CoreServiceProvider.php, line 106
Class
- CoreServiceProvider
- ServiceProvider class for mandatory core services.
Namespace
Drupal\CoreCode
public function alter(ContainerBuilder $container) {
$uuid_service = $container
->getDefinition('uuid');
// Debian/Ubuntu uses the (broken) OSSP extension as their UUID
// implementation. The OSSP implementation is not compatible with the
// PECL functions.
if (function_exists('uuid_create') && !function_exists('uuid_make')) {
$uuid_service
->setClass('Drupal\\Component\\Uuid\\Pecl');
}
elseif (function_exists('com_create_guid')) {
$uuid_service
->setClass('Drupal\\Component\\Uuid\\Com');
}
}