public function getId($service): ?string
    {
        if ($this->serviceContainer === $service) {
            return 'service_container';
        }

        if (null === $id = ($this->getServiceId)($service)) {
            return null;
        }

        if ($this->serviceContainer->has($id) || $this->reversibleLocator->has($id)) {
            return $id;
        }

        return null;
    }
public function getId($service): ?string
    {
        if ($this->serviceContainer === $service) {
            return 'service_container';
        }

        if (null === $id = ($this->getServiceId)($service)) {
            return null;
        }

        if ($this->serviceContainer->has($id) || $this->reversibleLocator->has($id)) {
            return $id;
        }

        return null;
    }
public function getId ( $ service ) : ? string { if ( $ this -> serviceContainer === $ service ) { return 'service_container' ; } if ( null === $ id = ( $ this -> getServiceId ) ( $ service ) ) { return null ; } if ( $ this -> serviceContainer -> has ( $ id ) || $ this -> reversibleLocator -> has ( $ id ) ) { return $ id ; } return null ; }
Returns the id of the passed object when it exists as a service.

To be reversible, services need to be either public or be tagged with "container.reversible".

@param object $service
Returns the id of the passed object when it exists as a service .