| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  * @author Bram Gerritsen [email protected] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * @copyright (c) Bram Gerritsen 2013 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * @license http://opensource.org/licenses/mit-license.php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | namespace StrokerCache\Factory; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | use Interop\Container\ContainerInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | use Interop\Container\Exception\ContainerException; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | use StrokerCache\Options\ModuleOptions; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | use Zend\Cache\StorageFactory; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | use Zend\ServiceManager\Exception\ServiceNotCreatedException; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | use Zend\ServiceManager\Exception\ServiceNotFoundException; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | use Zend\ServiceManager\FactoryInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | use Zend\ServiceManager\ServiceLocatorInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | class CacheStorageFactory implements FactoryInterface | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |      * {@inheritDoc} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |     public function createService(ServiceLocatorInterface $serviceLocator) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |         return $this($serviceLocator, StorageFactory::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |      * Create an object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |      * @param  ContainerInterface $container | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |      * @param  string $requestedName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |      * @param  null|array $options | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |      * @return object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |      * @throws ServiceNotFoundException if unable to resolve the service. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |      * @throws ServiceNotCreatedException if an exception is raised when | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |      *     creating a service. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |      * @throws ContainerException if any other error occurs | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 40 |  |  |      */ | 
            
                                                        
            
                                    
            
            
                | 41 |  |  |     public function __invoke(ContainerInterface $container, $requestedName, array $options = null) | 
            
                                                        
            
                                    
            
            
                | 42 |  |  |     { | 
            
                                                        
            
                                    
            
            
                | 43 |  |  |         /** @var $options ModuleOptions */ | 
            
                                                        
            
                                    
            
            
                | 44 |  |  |         $options = $container->get(ModuleOptions::class); | 
            
                                                        
            
                                    
            
            
                | 45 |  |  |         $adapterOptions = ['adapter' => $options->getStorageAdapter()]; | 
            
                                                        
            
                                    
            
            
                | 46 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 47 |  |  |         return StorageFactory::factory($adapterOptions); | 
            
                                                        
            
                                    
            
            
                | 48 |  |  |     } | 
            
                                                        
            
                                    
            
            
                | 49 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 50 |  |  |  | 
            
                        
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.