public function get($service)
    {
        // Is the service active?
        if (isset($this->active[$service])) {
            if ($this->loaded[$service]['singleton']) {
                return $this->active[$service];
            } else {
                return $this->load($service);
            }
        } elseif (isset($this->loaded[$service])) {
            // Is the service loaded?
            return $this->load($service);
        }

        $message  = "CDI the service accessed '$service' is not loaded in the DI-container.";
        $services = $this->getServices();
        natcasesort($services);
        $services = implode("\n", $services);
        $message .= " Loaded services are: <pre>$services</pre>";
        
        throw new \Exception($message);
    }
public function get($service)
    {
        // Is the service active?
        if (isset($this->active[$service])) {
            if ($this->loaded[$service]['singleton']) {
                return $this->active[$service];
            } else {
                return $this->load($service);
            }
        } elseif (isset($this->loaded[$service])) {
            // Is the service loaded?
            return $this->load($service);
        }

        $message  = "CDI the service accessed '$service' is not loaded in the DI-container.";
        $services = $this->getServices();
        natcasesort($services);
        $services = implode("\n", $services);
        $message .= " Loaded services are: <pre>$services</pre>";
        
        throw new \Exception($message);
    }
public function get ( $ service ) { // Is the service active? if ( isset ( $ this -> active [ $ service ] ) ) { if ( $ this -> loaded [ $ service ] [ 'singleton' ] ) { return $ this -> active [ $ service ] ; } else { return $ this -> load ( $ service ) ; } } elseif ( isset ( $ this -> loaded [ $ service ] ) ) { // Is the service loaded? return $ this -> load ( $ service ) ; } $ message = "CDI the service accessed '$service' is not loaded in the DI-container." ; $ services = $ this -> getServices ( ) ; natcasesort ( $ services ) ; $ services = implode ( "\n" , $ services ) ; $ message .= " Loaded services are: <pre>$services</pre>" ; throw new \ Exception ( $ message ) ; }
Get an instance of the service object, managing singletons.

@param string $service as a service label, naming this service.

@return object as instance of the service object.
@throws Exception when service accessed is not loaded.
Get an instance of the service object managing singletons .