Get Service

@param string $name Service name

@throws Exception

@return mixed
964738
public function getService($name)
    {
        if (array_key_exists($name, $this->services)) {
            return $this->services[$name];
        } elseif (isset($this->serviceProviders[$name]) && $this->serviceProviders[$name] instanceof ServiceProviderInterface) {
            $service = $this->serviceProviders[$name]->instantiate();
            if (!empty($this->serviceConfiguration[$name]['persistent'])) {
                $this->setService($name, $service);
            }
            return $service;
        } else {
            throw new Exception("Requested service {$name} is not registered");
        }
    }
348976
public static function get($name)
    {
        if (!isset(self::$connections[$name])) {
            throw new Exception(sprintf('Connection "%s" does not exist.', $name));
        }

        return self::$connections[$name];
    }
356555
public function get($name)
    {
        // get from cache
        if (isset($this->pool[$name])) {
            return $this->pool[$name];
        }
        
        // check if connection exists
        if (!isset($this->configuration[$name])) {
            throw new Exception('Connection with name ' . $name . ' not found');
        }
        
        // check if dsn exists
        if (!isset($this->configuration[$name]['dsn'])) {
            $this->configuration[$name]['dsn'] = null;
        }
        
        // check if connect options exists
        if (empty($this->configuration[$name]['connectOptions'])) {
            $this->configuration[$name]['connectOptions'] = null;
        }
        
        // init client
        $client = new Client(
            $this->configuration[$name]['dsn'],
            $this->configuration[$name]['connectOptions']
        );
        
        if (isset($this->configuration[$name]['mapping'])) {
            $client->map($this->configuration[$name]['mapping']);
        }
        
        if (isset($this->configuration[$name]['defaultDatabase'])) {
            $client->useDatabase($this->configuration[$name]['defaultDatabase']);
        }
        
        $this->pool[$name] = $client;
        
        return $client;
    }
677804
public static function get($name) 
		{
			if (array_key_exists($name, self::$_auths)) {
				return self::$_auths[$name];
			} else {
				throw new \Exception("There is no Auth defined for '$name'.", 1);				
			}
		}
1367411
public function _get($name)
    {
        $object = $this->getObject();
		$callable = function() use ($name, $object) {
			if (!property_exists($object, $name) && !method_exists($object, '__get'))
			{
				throw new \Exception('Property ' . $name . ' doesn\'t exist on object of class ' . get_class($object));
			}
			if (is_array($object->$name))
			{
				$object->$name = new \ArrayObject($object->$name);
			}
			return $object->$name;
		};
		return $this->breakScopeAndExecute($callable);
    }
574144
public function get($name)
    {
        if (! $this->has($name)) {
            $message = sprintf('No responder for failed rule "%s"', $name);
            throw new Exception($message);
        }
        $factory = $this->factories[$name];
        return $factory();
    }
748559
protected function get($name)
    {
        if ($this->modified === null) {
            $this->load();
        }

        if (false === array_key_exists($name, $this->properties)) {
            throw new Exception('Unknown property "' . $name . '"');
        }

        return $this->resolve($this->properties[$name], $name);
    }
1358691
public function getService($name = null)
    {
        $name = $name ?: $this->defaultService;

        if (!$name) {
            throw new \RuntimeException(sprintf(
                'You must configure a default %s service, registered %s services: "%s"',
                $this->serviceType, $this->serviceType,
                implode('", "', array_keys($this->services))
            ));
        }

        if (isset($this->services[$name])) {
            return $this->services[$name];
        }

        $this->assertServiceExists($name);
        $this->services[$name] = $this->container->get($this->serviceMap[$name]);

        return $this->services[$name];
    }
217672
public function get(string $name)
    {
        if (!isset($this->services[$name])) {
            throw new \LogicException(\sprintf('Global variable %s could not be located. You should define it.', \json_encode($name)));
        }

        return $this->services[$name];
    }
1169475
private function getServiceClass($name)
    {
        $serviceId = $this->getServiceId($name);
        $parameterId = $serviceId.'.class';
        if ($this->container->hasParameter($parameterId)) {
            $class = $this->container->getParameter($parameterId);
        } elseif (array_key_exists($name, $this->options)) {
            $class = $this->options[$name];
        } else {
            throw new \RuntimeException(sprintf('Undefined "%s" service class.', $name));
        }
        return $class;
    }
295274
public function getRoute($name)
    {
        if (empty($name)) {
            throw new \InvalidArgumentException("Route name not provided.");
        }

        // TODO: This is not very efficient, maybe find a better way
        foreach ($this->routes as $route) {
            if ($route->getName() === $name) {
                return $route;
            }
        }

        throw new \Exception("Route \"$name\" not found.");
    }
158017
protected function getParam(string $name)
    {
        if (!array_key_exists($name, $this->_params)) {
            throw new Exception ('Required parameter "' . $name . '" was not set');
        }

        return $this->_params[$name];
    }
142693
public function getByName($name)
    {
        if (isset($this->searchServices[$name])) {
            return $this->searchServices[$name];
        } else {
            throw new UnknowSearchNameException($name);
        }
    }
1364551
public function getConfiguration($name)
    {
        if (!isset($this->config[$name]['configuration_class'])) {
            throw new \Exception(sprintf('Configuration for "%s" not found', $name));
        }
        $class = $this->config[$name]['configuration_class'];

        return new $class();
    }
256186
public static service get(nitro_service service, String name) throws Exception{
		service obj = new service();
		obj.set_name(name);
		service response = (service) obj.get_resource(service);
		return response;
	}
381199
public function get(string $name)
    {
        return isset(self::$services[$name]) ? self::$services[$name] : null;
    }
1021761
public function get($name)
    {
        if (!isset($this->_definitions[$name])) {
            throw new BoxException("Unexisting `{$name}` definition dependency.");
        }

        extract($this->_definitions[$name]);

        if ($type === 'singleton') {
            return $definition;
        }

        $params = func_get_args();
        array_shift($params);

        if ($type === 'service') {
            return $definition = $this->_service($name, $definition, $params);
        }
        return $definition = $this->_factory($definition, $params);
    }