Retrieve the cache service.

@throws RuntimeException If the cache service was not previously set.
@return CacheItemPoolInterface
493241
protected function cachePool()
    {
        if ($this->cachePool === null) {
            throw new RuntimeException(sprintf(
                'Cache Pool is not defined for "%s"',
                get_class($this)
            ));
        }

        return $this->cachePool;
    }
693162
public function getAdapter()
    {
        if (!$this->adapter) {
            throw new Exception\RuntimeException(sprintf(
                '"%s" unable to load adapter; adapter not found',
                __METHOD__
            ));
        }
        if (method_exists($this->adapter, 'setOptions')) {
            $this->adapter->setOptions($this->getAdapterOptions());
        }

        return $this->adapter;
    }
391994
public function getActiveProvider()
    {
        if ($this->activeProvider instanceof ProviderInterface) {
            return $this->activeProvider;
        }

        if (empty($this->providers)) {
            throw new RuntimeException('No versioning provider found');
        }

        foreach ($this->providers as $entry) {
            $provider = $entry['provider'];
            /** @var $provider ProviderInterface */
            if ($provider->isSupported()) {
                $this->activeProvider = $provider;

                return $provider;
            }
        }

        throw new RuntimeException('No supported versioning providers found');
    }
1094159
public function get($key)
	{
		// If the cached data has expired remove it and return.
		if ($this->exists($key) && $this->isExpired($key))
		{
			try
			{
				$this->remove($key);
			}
			catch (\RuntimeException $e)
			{
				throw new \RuntimeException(sprintf('Unable to clean expired cache entry for %s.', $key), null, $e);
			}

			return new Item($key);
		}

		if (!$this->exists($key))
		{
			return new Item($key);
		}

		$resource = @fopen($this->fetchStreamUri($key), 'rb');

		if (!$resource)
		{
			throw new \RuntimeException(sprintf('Unable to fetch cache entry for %s.  Connot open the resource.', $key));
		}

		// If locking is enabled get a shared lock for reading on the resource.
		if ($this->options['file.locking'] && !flock($resource, LOCK_SH))
		{
			throw new \RuntimeException(sprintf('Unable to fetch cache entry for %s.  Connot obtain a lock.', $key));
		}

		$data = stream_get_contents($resource);

		// If locking is enabled release the lock on the resource.
		if ($this->options['file.locking'] && !flock($resource, LOCK_UN))
		{
			throw new \RuntimeException(sprintf('Unable to fetch cache entry for %s.  Connot release the lock.', $key));
		}

		fclose($resource);

		$item = new Item($key);
		$item->setValue(unserialize($data));

		return $item;
	}
527365
protected function getServiceLocatorFactory(): ServiceLocatorFactoryInterface
    {
        if (! $this->factory instanceof ServiceLocatorFactoryInterface) {
            $this->factory = new ServiceLocatorFactory();
        }

        return $this->factory ?: new ServiceLocatorFactory();
    }
1157218
public function getCacheFrontend() {
		if ($this->_cacheFrontendWrapper === null) {
			// Try the personal frontend for the service
			if ($this instanceof LocatorAwareInterface && $this->hasLocator()) {
				$locator   = $this->getLocator();
				$serviceId = $this->getCacheFrontendServiceId();
				
				if ($locator->has($serviceId)) {
					$this->_cacheFrontendWrapper = $locator->get($serviceId);
					return $this->_cacheFrontendWrapper;
				}
			}
			
			// Try to create through a factory
			if ($this->hasCacheFrontendFactory() && method_exists($this, 'getServiceName')) {
				$this->_cacheFrontendWrapper = $this->getCacheFrontendFactory()->createWrapper($this->getServiceName());
				return $this->_cacheFrontendWrapper;
			}
			
			throw new NoFrontend('Unable to provide the cache frontend');
		}
		
		return $this->_cacheFrontendWrapper;
	}
1371584
public function getCacheFrontendFactory() {
		if ($this->_cacheFrontendFactory === null) {
			if ($this instanceof LocatorAwareInterface && $this->hasLocator()) {
				$locator   = $this->getLocator();
				$serviceId = $this->getCacheFrontendFactoryServiceId();
				
				if ($locator->has($serviceId)) {
					$this->_cacheFrontendFactory = $locator->get($serviceId);
					return $this->_cacheFrontendFactory;
				}
			}
			
			throw new NoFrontend('Unable to provide the cache frontend\'s factory');
		}
		
		return $this->_cacheFrontendFactory;
	}
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];
    }
341499
public function getServiceUtil()
    {
        if ($this->serviceUtil) {
            return $this->serviceUtil;
        }

        $className = $this->getServiceUtilClassName();
        $r = new ReflectionClass($className);
        $instance = $r->newInstance();

        if (!$instance instanceof ServiceUtilInterface) {
            $errMsg = sprintf('Service util not implement %s', ServiceUtilInterface::class);
            throw new Exception\RuntimeException($errMsg);
        }
        $this->serviceUtil = $instance;

        return $this->serviceUtil;
    }
1160366
public static function factory($name)
    {
        if (!isset(self::$services[$name])) {
            throw new \RuntimeException("The service [$name] don't register.");
        }

        $service = self::$services[$name];

        if (\is_object($service) && method_exists($service, '__invoke')) {
            return $service();
        }

        return $service;
    }
336992
public function getEntityService()
    {
        if (null === $this->entityService) {
            $entityServiceClass = $this->getEntityServiceClass();
            if (!class_exists($entityServiceClass)) {
                throw new \RuntimeException("Classe $entityServiceClass inexistente!");
            }
            $this->entityService = new $entityServiceClass();
            $this->entityService->setServiceLocator($this->getServiceLocator());
        }

        return $this->entityService;
    }
22924
public function getCached()
    {
        $cached = $this->cache->get(
            $this->getCacheKey(),
            []
        );

        return $this->formatCache($cached);
    }
940148
public function getObjectManager()
    {
        $manager = $this->registry->getManagerForClass($this->class);

        if (!$manager) {
            throw new \RuntimeException(sprintf(
                'Unable to find the mapping information for the class %s.'
                .' Please check the `auto_mapping` option'
                .' (http://symfony.com/doc/current/reference/configuration/doctrine.html#configuration-overview)'
                .' or add the bundle to the `mappings` section in the doctrine configuration.',
                $this->class
            ));
        }

        return $manager;
    }
68643
public function getCacheDir()
    {
        if ($this->cacheDir === null) {
            $this->setCacheDir(dirname(__DIR__) . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR);
        }

        return $this->cacheDir;
    }
449937
public function getCacheRepository()
    {
        if (is_null($this->cacheRepository)) {
            $this->cacheRepository = app(config('repository.cache.repository', 'cache'));
        }

        return $this->cacheRepository;
    }
7359
protected function collectionLoader()
    {
        if ($this->collectionLoader === null) {
            throw new RuntimeException(sprintf(
                'Collection Loader is not defined for "%s"',
                get_class($this)
            ));
        }

        return $this->collectionLoader;
    }
614250
public function collectionLoaderFactory()
    {
        if (!isset($this->collectionLoaderFactory)) {
            throw new RuntimeException(sprintf(
                'Collection Loader Factory is not defined for [%s]',
                get_class($this)
            ));
        }

        return $this->collectionLoaderFactory;
    }