Get a service

@param string $serviceName
@return object|null
426216
public function getService($serviceName) {
        if (static::$container->offsetExists($serviceName) === false) {
            return null;
        }

        return static::$container->offsetGet($serviceName);
    }
685759
function newService($serviceName = null)
    {
        ($serviceName) ?: $serviceName = $this->currentService;
        if ($serviceName === null)
            throw new \Exception('Service name is empty; use ::withService() method.');


        if (false === $service = $this->_resolveTo($serviceName))
            throw new \Exception(sprintf('Cant Resolve To Plugin Service (%s).', $serviceName));

        if ( is_string($service) && class_exists($service) ) {
            // Resolved Class Name
            $options = \Poirot\Std\cast($this->optsData())->toArray();
            $service = \Poirot\Ioc\newInitIns(new instance($service, $options), $this->sc);

        }

        return $service;
    }
1018476
public static function oneById($serviceName, $id)
	{
		if(!self::has($serviceName)) {
			return null;
		}
		/** @var ReadOneInterface $serviceInstance */
		$serviceInstance = self::get($serviceName);
		try {
			$result = $serviceInstance->oneById($id);
		} catch (NotFoundHttpException $e) {
			$result = null;
		}
		return $result;
	}
745187
protected function loadService($serviceName, $serviceConfig)
    {
        $isSingleton = false;

        if (array_key_exists('singleton', $serviceConfig)) {
            $isSingleton = (bool)$serviceConfig['singleton'];
        }

        $class = $this->activate($serviceName, $serviceConfig);

        if ($isSingleton) {
            // Only store if singleton'ed to spare memory
            $this->registry->set($serviceName, $class);
        }

        $this->inject($class, $serviceConfig);
        $class = $this->encapsulate($class, $serviceConfig);

        return $class;
    }
1259175
protected function getConfigHelper($serviceName)
    {
        $storage = new HydraTokenStorage();
        $provider = new DefaultServiceProvider($storage);

        $className = $this->getConfigHelperClassName($serviceName);

        return new $className(
            $storage,
            $provider,
            $serviceName
        );
    }
1179399
public function getServiceMethod($methodName)
    {
        return $this->getService($this->getServiceName($methodName)) instanceof Service ? $this->getService($this->getServiceName($methodName))->getMethod($methodName) : null;
    }
739507
protected function getService()
    {
        if (!isset($this->service)) {
            $this->service = $this->getServiceLocator()
                    ->get($this->getModuleNamespace() . '\Service\\' . $this->getEntityName());
        }

        return $this->service;
    }
644355
private function getService(string $service)
    {
        if ($this->container instanceof ContainerInterface && $this->container->has($service)) {
            return $this->container->get($service);
        }

        return new $service();
    }
830460
public function getCredentialsByService($serviceName)
    {
        if (!in_array($serviceName, $this->getInitializedServices())) {
            throw new DomainException(
                sprintf("Credentials for service '%s' was not initialized", $serviceName)
            );
        }

        return $this->serviceCredentials[$serviceName];
    }
231092
protected function getRegisterServiceArguments($serviceName)
    {
        $this->assertServiceExist($serviceName);

        return isset($this->services[$serviceName]['arguments'])
            ? $this->services[$serviceName]['arguments']
            : $this->services[$serviceName]['arguments'] = $this->getServiceArgumentNames($this->services[$serviceName]['definition']);
    }
1347824
protected function getService($name)
	{
		if (!isset($this->container[$name])) {
			throw new \Exception(sprintf('There is no service (connection or entity manager) with id "%s"', $name));
		}

		return $this->container[$name];
	}
259957
protected function getWsdl($serviceName)
	{
		if($this->cacheStatus)
		{
			if(null === $this->cacheInstance)
			{
				$this->createCacheInstance();
			}
			$_this = $this;
			return $this->cacheInstance->get($cacheName,function()use($serviceName,$_this){
				return $_this->getWsdlNoCache($serviceName);
			},array('raw'=>true));
		}
		else
		{
			return $this->getWsdlNoCache($serviceName);
		}
	}
1149349
public function getService($service = null)
    {
        if ( $service and ! array_key_exists($service, $this->service) )
        {
            $this->setService($service);
        }

        $this->setToken();

        return $this->service[$service];
    }
499177
public function get($className) {
        if (!$this->has($className)) {
            $errorMsg = sprintf(self::ERROR_SERVICE_NOT_FOUND, $className);
            throw new ulfberhtException($errorMsg);
        }
        //return service from service cache if it is there
        if (isset($this->_serviceCache[$className])) {
            return $this->_serviceCache[$className];
        }

        return $this->_resolveService($className);
    }
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);
        }
    }
389191
public function get($serviceClassName)
    {
        if (false === $this->hasBeenInitialized) {
            throw new InitializationNotSetException(
                'You can get a service instance only when the service factory has been initialized.',
                1456419587
            );
        }

        if (false === $this->has($serviceClassName)) {
            throw new EntryNotFoundException(
                'The service "' . $serviceClassName . '" was not found in this service factory. Attach it before trying to get it!',
                1456419653
            );
        }

        return $this->serviceInstances[$serviceClassName];
    }
547288
private function getService(string $name, array $params = []): ?IService
    {
        if (array_key_exists($name, $this->servicesInstances)) {
            return $this->servicesInstances[$name];
        }

        $serviceConfig = $this->getServiceConfig($name);
        if ($serviceConfig === null) {
            return null;
        }

        $class = $serviceConfig['class'];
        unset($serviceConfig['class']);
        $serviceConfig = array_merge($serviceConfig, isset($params[0]) && \is_array($params[0]) ? $params[0] : []);

        if (!class_exists($class)) {
            throw new InvalidConfigException(sprintf('Class %s does not exists', $class));
        }

        if (\is_subclass_of($class, BaseModelService::class)
            || \is_subclass_of($class, BaseControllerService::class)
        ) {
            $service = new $class($this, $serviceConfig);
        } else {
            $service = new $class($serviceConfig);
        }

        if (!($service instanceof IService)) {
            throw new InvalidConfigException('Service class must implement `' . IService::class . '`.');
        }

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