You are here

public static function Drupal::hasService in Zircon Profile 8

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

Indicates if a service is defined in the container.

Parameters

string $id: The ID of the service to check.

Return value

bool TRUE if the specified service exists, FALSE otherwise.

11 calls to Drupal::hasService()
comment_entity_storage_load in core/modules/comment/comment.module
Implements hook_entity_storage_load().
drupal_get_filename in core/includes/bootstrap.inc
Returns and optionally sets the filename for a system resource.
ExtensionDiscovery::scan in core/lib/Drupal/Core/Extension/ExtensionDiscovery.php
Discovers available extensions of a given type.
FormBuilder::currentUser in core/lib/Drupal/Core/Form/FormBuilder.php
Gets the current active user.
PublicStream::basePath in core/lib/Drupal/Core/StreamWrapper/PublicStream.php
Returns the base path for public://.

... See full list

File

core/lib/Drupal.php, line 170
Contains \Drupal.

Class

Drupal
Static Service Container wrapper.

Code

public static function hasService($id) {

  // Check hasContainer() first in order to always return a Boolean.
  return static::hasContainer() && static::getContainer()
    ->has($id);
}