function ReverseContainer::generateServiceIdHash
Same name in other branches
- 9 core/lib/Drupal/Component/DependencyInjection/ReverseContainer.php \Drupal\Component\DependencyInjection\ReverseContainer::generateServiceIdHash()
- 11.x core/lib/Drupal/Component/DependencyInjection/ReverseContainer.php \Drupal\Component\DependencyInjection\ReverseContainer::generateServiceIdHash()
Generates an identifier for a service based on the object class and hash.
Parameters
object $object: The object to generate an identifier for.
Return value
string The object's class and hash concatenated together.
1 call to ReverseContainer::generateServiceIdHash()
- ReverseContainer::getId in core/
lib/ Drupal/ Component/ DependencyInjection/ ReverseContainer.php - Returns the ID of the passed object when it exists as a service.
File
-
core/
lib/ Drupal/ Component/ DependencyInjection/ ReverseContainer.php, line 87
Class
- ReverseContainer
- Retrieves service IDs from the container for public services.
Namespace
Drupal\Component\DependencyInjectionCode
private function generateServiceIdHash(object $object) : string {
// Include class name as an additional namespace for the hash since
// spl_object_hash's return can be recycled. This still is not a 100%
// guarantee to be unique but makes collisions incredibly difficult and even
// then the interface would be preserved.
// @see https://php.net/spl_object_hash#refsect1-function.spl-object-hash-notes
return get_class($object) . spl_object_hash($object);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.