You are here

public static function CoreServiceProvider::registerUuid in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/CoreServiceProvider.php \Drupal\Core\CoreServiceProvider::registerUuid()

Determines and registers the UUID service.

Parameters

\Symfony\Component\DependencyInjection\ContainerBuilder $container: The container.

Return value

string Class name for the UUID service.

1 call to CoreServiceProvider::registerUuid()
CoreServiceProvider::register in core/lib/Drupal/Core/CoreServiceProvider.php
Registers services to the container.

File

core/lib/Drupal/Core/CoreServiceProvider.php, line 114
Contains \Drupal\Core\CoreServiceProvider.

Class

CoreServiceProvider
ServiceProvider class for mandatory core services.

Namespace

Drupal\Core

Code

public static function registerUuid(ContainerBuilder $container) {
  $uuid_class = 'Drupal\\Component\\Uuid\\Php';

  // 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_class = 'Drupal\\Component\\Uuid\\Pecl';
  }
  elseif (function_exists('com_create_guid')) {
    $uuid_class = 'Drupal\\Component\\Uuid\\Com';
  }
  $container
    ->register('uuid', $uuid_class);
  return $uuid_class;
}