src/ServiceLocator.php
public function get($name)
    {
        if (isset($this->instances[$name])) {
            return $this->instances[$name];
        }
        if (! isset($this->registry[$name])) {
            $exceptionClass = static::NOT_FOUND_EXCEPTION;
            throw new $exceptionClass(
                sprintf(static::NOT_FOUND_MESSAGE, $name)
            );
        }
        try {
            $this->instances[$name] = $this->build($this->registry[$name], $name);
        } catch (Exception $e) {
            throw new RuntimeException(
                sprintf(static::BUILD_FAILURE_MESSAGE, $name),
                null,
                $e
            );
        }

        return $this->instances[$name];
    }
public function get($name)
    {
        if (isset($this->instances[$name])) {
            return $this->instances[$name];
        }
        if (! isset($this->registry[$name])) {
            $exceptionClass = static::NOT_FOUND_EXCEPTION;
            throw new $exceptionClass(
                sprintf(static::NOT_FOUND_MESSAGE, $name)
            );
        }
        try {
            $this->instances[$name] = $this->build($this->registry[$name], $name);
        } catch (Exception $e) {
            throw new RuntimeException(
                sprintf(static::BUILD_FAILURE_MESSAGE, $name),
                null,
                $e
            );
        }

        return $this->instances[$name];
    }
public function get ( $ name ) { if ( isset ( $ this -> instances [ $ name ] ) ) { return $ this -> instances [ $ name ] ; } if ( ! isset ( $ this -> registry [ $ name ] ) ) { $ exceptionClass = static :: NOT_FOUND_EXCEPTION ; throw new $ exceptionClass ( sprintf ( static :: NOT_FOUND_MESSAGE , $ name ) ) ; } try { $ this -> instances [ $ name ] = $ this -> build ( $ this -> registry [ $ name ] , $ name ) ; } catch ( Exception $ e ) { throw new RuntimeException ( sprintf ( static :: BUILD_FAILURE_MESSAGE , $ name ) , null , $ e ) ; } return $ this -> instances [ $ name ] ; }
Gets the service.

@param string $name The service name

@throws Exception\ServiceNotFoundException If the specified service not fount
@throws \RunimeException                   If failled build a service

@return mixed The requested service
Gets the service .