Skip to content

Commit

Permalink
TASK: Remove code dealing with removed class/interface
Browse files Browse the repository at this point in the history
The `FlowSpecificBackendInterface` as well as `Neos\Flow\Cache\Backend`
are gone with Flow 5.0, so this code is never executed.

The `implements CacheFactoryInterface` is redundant, thus removed.
  • Loading branch information
kdambekalns committed Dec 3, 2019
1 parent f1313f9 commit 13257df
Showing 1 changed file with 2 additions and 36 deletions.
38 changes: 2 additions & 36 deletions Classes/Cache/CacheFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,9 @@

use Neos\Cache\Backend\BackendInterface;
use Neos\Cache\Backend\SimpleFileBackend;
use Neos\Cache\CacheFactoryInterface;
use Neos\Cache\EnvironmentConfiguration;
use Neos\Cache\Frontend\FrontendInterface;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Cache\Backend\AbstractBackend as FlowAbstractBackend;
use Neos\Flow\Cache\Backend\FlowSpecificBackendInterface;
use Neos\Cache\Exception\InvalidBackendException;
use Neos\Flow\Core\ApplicationContext;
use Neos\Flow\ObjectManagement\ObjectManagerInterface;
Expand All @@ -32,7 +29,7 @@
* @Flow\Scope("singleton")
* @api
*/
class CacheFactory extends \Neos\Cache\CacheFactory implements CacheFactoryInterface
class CacheFactory extends \Neos\Cache\CacheFactory
{
/**
* The current Flow context ("Production", "Development" etc.)
Expand Down Expand Up @@ -133,7 +130,7 @@ protected function instantiateCache(string $cacheIdentifier, string $cacheObject
* @param array $backendOptions
* @param EnvironmentConfiguration $environmentConfiguration
* @param boolean $persistent
* @return FlowAbstractBackend|BackendInterface
* @return BackendInterface
* @throws InvalidBackendException
*/
protected function instantiateBackend(string $backendObjectName, array $backendOptions, EnvironmentConfiguration $environmentConfiguration, bool $persistent = false): BackendInterface
Expand All @@ -147,37 +144,6 @@ protected function instantiateBackend(string $backendObjectName, array $backendO
$backendOptions['baseDirectory'] = FLOW_PATH_DATA . 'Persistent/';
}

if (is_a($backendObjectName, FlowSpecificBackendInterface::class, true)) {
return $this->instantiateFlowSpecificBackend($backendObjectName, $backendOptions);
}

return parent::instantiateBackend($backendObjectName, $backendOptions, $environmentConfiguration);
}

/**
* @param string $backendObjectName
* @param array $backendOptions
* @return FlowAbstractBackend
* @throws InvalidBackendException
*/
protected function instantiateFlowSpecificBackend(string $backendObjectName, array $backendOptions)
{
$backend = new $backendObjectName($this->context, $backendOptions);

if (!$backend instanceof BackendInterface) {
throw new InvalidBackendException('"' . $backendObjectName . '" is not a valid cache backend object.', 1216304301);
}

/** @var FlowAbstractBackend $backend */
$backend->injectEnvironment($this->environment);

if (is_callable([$backend, 'injectCacheManager'])) {
$backend->injectCacheManager($this->cacheManager);
}
if (is_callable([$backend, 'initializeObject'])) {
$backend->initializeObject(ObjectManagerInterface::INITIALIZATIONCAUSE_CREATED);
}

return $backend;
}
}

0 comments on commit 13257df

Please sign in to comment.