This repository has been archived by the owner on Jan 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merging develop to master in preparation for 2.7.0
- Loading branch information
Showing
28 changed files
with
1,854 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
/** | ||
* @link http://github.com/zendframework/zend-cache for the canonical source repository | ||
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
namespace Zend\Cache; | ||
|
||
class ConfigProvider | ||
{ | ||
/** | ||
* Return default configuration for zend-cache. | ||
* | ||
* @return array | ||
*/ | ||
public function __invoke() | ||
{ | ||
return [ | ||
'dependencies' => $this->getDependencyConfig(), | ||
]; | ||
} | ||
|
||
/** | ||
* Return default service mappings for zend-cache. | ||
* | ||
* @return array | ||
*/ | ||
public function getDependencyConfig() | ||
{ | ||
return [ | ||
'abstract_factories' => [ | ||
Service\StorageCacheAbstractServiceFactory::class, | ||
], | ||
'factories' => [ | ||
PatternPluginManager::class => Service\PatternPluginManagerFactory::class, | ||
Storage\AdapterPluginManager::class => Service\StorageAdapterPluginManagerFactory::class, | ||
Storage\PluginManager::class => Service\StoragePluginManagerFactory::class, | ||
], | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
/** | ||
* @link http://github.com/zendframework/zend-cache for the canonical source repository | ||
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
namespace Zend\Cache; | ||
|
||
class Module | ||
{ | ||
/** | ||
* Return default zend-cache configuration for zend-mvc context. | ||
* | ||
* @return array | ||
*/ | ||
public function getConfig() | ||
{ | ||
$provider = new ConfigProvider(); | ||
return [ | ||
'service_manager' => $provider->getDependencyConfig(), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
/** | ||
* @link http://github.com/zendframework/zend-cache for the canonical source repository | ||
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
namespace Zend\Cache\Service; | ||
|
||
use Interop\Container\ContainerInterface; | ||
use Zend\Cache\PatternPluginManager; | ||
use Zend\ServiceManager\FactoryInterface; | ||
use Zend\ServiceManager\ServiceLocatorInterface; | ||
|
||
class PatternPluginManagerFactory implements FactoryInterface | ||
{ | ||
/** | ||
* zend-servicemanager v2 support for invocation options. | ||
* | ||
* @param array | ||
*/ | ||
protected $creationOptions; | ||
|
||
/** | ||
* {@inheritDoc} | ||
* | ||
* @return PatternPluginManager | ||
*/ | ||
public function __invoke(ContainerInterface $container, $name, array $options = null) | ||
{ | ||
return new PatternPluginManager($container, $options ?: []); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
* | ||
* @return PatternPluginManager | ||
*/ | ||
public function createService(ServiceLocatorInterface $container, $name = null, $requestedName = null) | ||
{ | ||
return $this($container, $requestedName ?: PatternPluginManager::class, $this->creationOptions); | ||
} | ||
|
||
/** | ||
* zend-servicemanager v2 support for invocation options. | ||
* | ||
* @param array $options | ||
* @return void | ||
*/ | ||
public function setCreationOptions(array $options) | ||
{ | ||
$this->creationOptions = $options; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
/** | ||
* @link http://github.com/zendframework/zend-cache for the canonical source repository | ||
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
namespace Zend\Cache\Service; | ||
|
||
use Interop\Container\ContainerInterface; | ||
use Zend\Cache\StorageFactory; | ||
use Zend\Cache\Storage\AdapterPluginManager; | ||
use Zend\Cache\Storage\PluginManager; | ||
|
||
trait PluginManagerLookupTrait | ||
{ | ||
/** | ||
* Prepare the storage factory with the adapter and plugins plugin managers. | ||
* | ||
* @param ContainerInterface $container | ||
* @return void | ||
*/ | ||
private function prepareStorageFactory(ContainerInterface $container) | ||
{ | ||
StorageFactory::setAdapterPluginManager($this->lookupStorageAdapterPluginManager($container)); | ||
StorageFactory::setPluginManager($this->lookupStoragePluginManager($container)); | ||
} | ||
|
||
/** | ||
* Lookup the storage adapter plugin manager. | ||
* | ||
* Returns the Zend\Cache\Storage\AdapterPluginManager service if present, | ||
* or creates a new instance otherwise. | ||
* | ||
* @param ContainerInterface $container | ||
* @return AdapterPluginManager | ||
*/ | ||
private function lookupStorageAdapterPluginManager(ContainerInterface $container) | ||
{ | ||
if ($container->has(AdapterPluginManager::class)) { | ||
return $container->get(AdapterPluginManager::class); | ||
} | ||
return new AdapterPluginManager($container); | ||
} | ||
|
||
/** | ||
* Lookup the storage plugins plugin manager. | ||
* | ||
* Returns the Zend\Cache\Storage\PluginManager service if present, or | ||
* creates a new instance otherwise. | ||
* | ||
* @param ContainerInterface $container | ||
* @return PluginManager | ||
*/ | ||
private function lookupStoragePluginManager(ContainerInterface $container) | ||
{ | ||
if ($container->has(PluginManager::class)) { | ||
return $container->get(PluginManager::class); | ||
} | ||
return new PluginManager($container); | ||
} | ||
} |
Oops, something went wrong.