public function getSingleton(string $serviceId)
    {
        // If the service isn't a singleton but is provided
        if (! $this->isSingleton($serviceId) && $this->isProvided($serviceId)) {
            // Initialize the provided service
            $this->initializeProvided($serviceId);
        }

        return self::$singletons[$serviceId];
    }
public function getSingleton(string $serviceId)
    {
        // If the service isn't a singleton but is provided
        if (! $this->isSingleton($serviceId) && $this->isProvided($serviceId)) {
            // Initialize the provided service
            $this->initializeProvided($serviceId);
        }

        return self::$singletons[$serviceId];
    }
public function getSingleton ( string $ serviceId ) { // If the service isn't a singleton but is provided if ( ! $ this -> isSingleton ( $ serviceId ) && $ this -> isProvided ( $ serviceId ) ) { // Initialize the provided service $ this -> initializeProvided ( $ serviceId ) ; } return self :: $ singletons [ $ serviceId ] ; }
Get a singleton from the container.

@param string $serviceId The service

@return mixed
Get a singleton from the container .