Returns a service. To prevent having to define a method per
service, instead we roll everything into one function

@param *string $name
@param string  $key

@return object
335485
public static function get($name, $key = 'main')
    {
        if (in_array($name, ['rabbitmq', 'redis'])) {
            $resource = cradle()->package('global')->service($name . '-' . $key);

            if ($resource) {
                if ($name === 'redis') {
                    return new RedisService($resource);
                }

                if ($name === 'rabbitmq') {
                    return new RabbitMQService($resource);
                }
            }
        }

        if ($name === 'rabbitmq') {
            return new NoopService();
        }

        return new NoopService('redis');
    }
758168
public function get($name) {
        if (!isset($this->services[$name])) throw new ServiceNotFoundException('Service "'.$name.'" not found.');
        try {
            return $this->services[$name]->resolve($factory=false);
        }
        catch (\Exception $ex) {
            throw new ContainerException($ex->getMessage(), $ex->getCode(), $ex);
        }
    }
254611
final public function get(string $name)
    {
        $service_selected = null;
        foreach ($this->services as $one => $val) {
            if ($val['name'] === $name) {
                if (!in_array($val['content']->status, array("enabled", "disabled"))) {
                    throw new Server500(new \ArrayObject(array("explain" =>
                        "Undefined status [ ".$val['content']->status." ] for ".$val['name']." service",
                        "solution" => "Please set the status [disabled] or [enabled]")));
                }
                if ($val['content']->status == "disabled") {
                    throw new Server500(new \ArrayObject(array("explain" =>
                        "The service [ ".$val['name']." ] is currently disabled ",
                        "solution" => "Please set the status [enabled] to enable the service")));
                }
                $i = $val['content']->namespace;
                $container = FrameworkContainer::getInstance();
                return ($container->get($i));
            }
        }

        throw new Server500(new \ArrayObject(array("explain" =>
            "Undefined service : $name", "solution" => "Please register the [$name] service")));
    }
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;
    }
638993
protected function getCacheService($key)
    {
        $service_name = $this->getOption('cache_service');

        return \Owl\Service\get($service_name, $key);
    }
859501
public function get($name,$default=null)
    {

        // Return null if the service is not in the container
        if(!isset($this->instances[$name]))
             return $default;

        if(array_key_exists($name,$this->bind))
            return $this->resolve($name);


        // Check if the service has been resolved in the container
        if(!$this->resolved[$name]){

            $this->instances[$name] = $this->resolve($name);
            

            return $this->instances[$name];
        }

        return $this->resolve($name);
    }
541714
public function get($name, array $parameters = [])
    {
        // Shared services are preserved through whole request
        if (isset($this->shared[$name])) {
            return $this->shared[$name];
        }

        if (!$this->has($name)) {
            throw new NotFoundException('No definition found for service "' . $name . '".');
        }

        $definition = $this->definitions[$name];

        // Alias is a link to another definition
        if (isset($definition['alias'])) {
            return $this->get($definition['alias']);
        }

        // "Init" directive is a function that returns instance of service
        if (isset($definition['init'])) {
            $service_class = call_user_func($definition['init'], $this, $parameters);

            if ($service_class === false) {
                throw new NotFoundException('"Init" directive for service "' . $name . '" did not produced any object.');
            }
        } else {
            $arguments = [];

            // Array of arguments which are given to constructor method
            if (isset($definition['arguments'])) {
                $arguments = $this->resolveArrayOfArguments($definition['arguments'], $parameters);
            }

            // Service is made by static method
            if (isset($definition['static'])) {
                $service_class = call_user_func_array([$definition['class'], $definition['static']], $arguments);

                if ($service_class === false) {
                    throw new NotFoundException('Class "' . $definition['class'] . '" for service "' . $name . '" was not found.');
                }
            } else {
                // Service is made by normal constructor
                try {
                    $reflection_class = new \ReflectionClass($definition['class']);
                } catch (\ReflectionException $e) {
                    throw new NotFoundException('Class "' . $definition['class'] . '" for service "' . $name . '" was not found.');
                }

                $service_class = $reflection_class->newInstanceArgs($arguments);
            }
        }

        // "After" directive is a function that is called after instantiation of service object
        if (isset($definition['after'])) {
            call_user_func($definition['after'], $this, $service_class, $parameters);
        }

        // Preserve shared service
        if (isset($definition['shared']) && $definition['shared'] === true) {
            $this->shared[$name] = $service_class;
        }

        return $service_class;
    }
74038
public function get($name)
    {
        if (isset($this->service_managers[$name])) {
            return $this->service_managers[$name];
        } else {
            throw new ServiceManagerNotFoundException('No service manager has been registered as ' . $name);
        }
    }
1304718
public static function get($name, $key = 'main')
    {
        if (in_array($name, ['sql', 'redis', 'elastic'])) {
            $resource = cradle('global')->service($name . '-' . $key);

            if ($resource) {
                if ($name === 'sql') {
                    return new SqlService($resource);
                }

                if ($name === 'redis') {
                    return new RedisService($resource);
                }

                if ($name === 'elastic') {
                    return new ElasticService($resource);
                }
            }
        }

        return new NoopService();
    }
818880
public function getServiceType($name)
    {
        if (isset($this->types[$name])) {
            return $this->types[$name];
        }

        return null;
    }
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");
        }
    }
674251
public static function getHash(string $name, string $key): string
    {
        $obj = new RedisHash(self::handle(), $name);
        return $obj->get($key);
    }
427556
public function set($name, $service)
    {
        if (isset($this->registry[$name])) {
            unset($this->registry[$name]);
        }
        if (isset($this->instances[$name])) {
            unset($this->instances[$name]);
        }
        if (null === $service) {
            return $this;
        }
        if (! is_string($service)) {
            $this->instances[$name] = $service;

            return $this;
        }
        $this->registry[$name] = $service;

        return $this;
    }
813588
public function getService(string $name, string $entry = null)
    {
        return $this->get('services', $name, $entry);
    }
1357037
public function fromQuery(Builder $builder, string $name, string $key = null): self
    {
        $key = $key ?? $builder->getModel()->getKeyName();

        return $this->setFromEloquent($builder, $name, $key);
    }
1182965
private function createServiceFromDelegator(string $name, array $options = null)
    {
        // @todo: This selection is necessary only because lazy services
        // configuration currently requires an explicit Delegator definition
        if ($this->delegators[$name][0] === Proxy\LazyServiceFactory::class) {
            return $this->createServiceFromLazyServiceDelegator($name, $options);
        }

        $creationCallback = $this->delegatorCallbackCache[$name] ?? null;
        if ($creationCallback) {
            $object = $creationCallback($this->creationContext, $name, $creationCallback, $options);
            return $object;
        }

        $creationCallback = function () use ($name, $options) {
            return $this->createServiceFromFactory($name, $options);
        };

        foreach ($this->delegators[$name] as $index => $delegatorFactory) {
            if (is_string($delegatorFactory) && class_exists($delegatorFactory)) {
                $delegatorFactory = new $delegatorFactory();
                if ($delegatorFactory instanceof DelegatorFactoryInterface) {
                    $this->delegators[$name][$index] = $delegatorFactory;
                    $creationCallback = function () use ($delegatorFactory, $name, $creationCallback, $options) {
                        return $delegatorFactory($this->creationContext, $name, $creationCallback, $options);
                    };
                    continue;
                }
            }
            if (is_callable($delegatorFactory)) {
                $creationCallback = function () use ($delegatorFactory, $name, $creationCallback, $options) {
                    return $delegatorFactory($this->creationContext, $name, $creationCallback, $options);
                };
                continue;
            }
            if (is_string($delegatorFactory)) {
                throw InvalidArgumentException::fromInvalidDelegatorFactoryClass($delegatorFactory);
            }
            throw InvalidArgumentException::fromInvalidDelegatorFactoryInstance($delegatorFactory);
        }

        //cache the callback for later requests
        $this->delegatorCallbackCache[$name] = $creationCallback;
        return $creationCallback($this->creationContext, $name, $creationCallback, $options);
    }
315092
private static function queue(string $name = null) : Queue
    {
        list($container, $config, $return) = DI::detect(__METHOD__, 'queue', $name);

        if ($return) {
            return $return;
        }

        $db = new Queue($config);

        return DI::set(__METHOD__, $container, $db);
    }