lib/Container.php
public function get($serviceId)
    {
        if (isset($this->services[$serviceId])) {
            return $this->services[$serviceId];
        }

        if (!isset($this->instantiators[$serviceId])) {
            throw new \InvalidArgumentException(sprintf(
                'No instantiator has been registered for requested service "%s"',
                $serviceId
            ));
        }

        $this->services[$serviceId] = $this->instantiators[$serviceId]($this);

        return $this->services[$serviceId];
    }
public function get($serviceId)
    {
        if (isset($this->services[$serviceId])) {
            return $this->services[$serviceId];
        }

        if (!isset($this->instantiators[$serviceId])) {
            throw new \InvalidArgumentException(sprintf(
                'No instantiator has been registered for requested service "%s"',
                $serviceId
            ));
        }

        $this->services[$serviceId] = $this->instantiators[$serviceId]($this);

        return $this->services[$serviceId];
    }
public function get ( $ serviceId ) { if ( isset ( $ this -> services [ $ serviceId ] ) ) { return $ this -> services [ $ serviceId ] ; } if ( ! isset ( $ this -> instantiators [ $ serviceId ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'No instantiator has been registered for requested service "%s"' , $ serviceId ) ) ; } $ this -> services [ $ serviceId ] = $ this -> instantiators [ $ serviceId ] ( $ this ) ; return $ this -> services [ $ serviceId ] ; }
Instantiate and return the service with the given ID.
Note that this method will return the same instance on subsequent calls.

@param string $serviceId

@return mixed
Instantiate and return the service with the given ID . Note that this method will return the same instance on subsequent calls .