public static Drupal::hasService($id)
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.
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);
}
Please login to continue.