function ReverseContainer::generateServiceObjectId
Same name and namespace in other branches
- 11.x core/lib/Drupal/Component/DependencyInjection/ReverseContainer.php \Drupal\Component\DependencyInjection\ReverseContainer::generateServiceObjectId()
Generates an identifier for a service based on the object class and ID.
Parameters
object $object: The object to generate an identifier for.
Return value
string The object's class and ID concatenated together.
1 call to ReverseContainer::generateServiceObjectId()
- 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 88
Class
- ReverseContainer
- Retrieves service IDs from the container for public services.
Namespace
Drupal\Component\DependencyInjectionCode
private function generateServiceObjectId(object $object) : string {
// Include class name as an additional namespace for the ID since
// spl_object_id'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://www.php.net/spl_object_id#refsect1-function.spl-object-id-notes
return get_class($object) . ':' . spl_object_id($object);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.