AdapterPluginManagerFactory.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * @link http://github.com/zendframework/zend-serializer for the canonical source repository
  4. * @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
  5. * @license http://framework.zend.com/license/new-bsd New BSD License
  6. */
  7. namespace Zend\Serializer;
  8. use Interop\Container\ContainerInterface;
  9. use Zend\ServiceManager\FactoryInterface;
  10. use Zend\ServiceManager\ServiceLocatorInterface;
  11. class AdapterPluginManagerFactory implements FactoryInterface
  12. {
  13. /**
  14. * zend-servicemanager v2 support for invocation options.
  15. *
  16. * @param array
  17. */
  18. protected $creationOptions;
  19. /**
  20. * {@inheritDoc}
  21. *
  22. * @return AdapterPluginManager
  23. */
  24. public function __invoke(ContainerInterface $container, $name, array $options = null)
  25. {
  26. return new AdapterPluginManager($container, $options ?: []);
  27. }
  28. /**
  29. * {@inheritDoc}
  30. *
  31. * @return AdapterPluginManager
  32. */
  33. public function createService(ServiceLocatorInterface $container, $name = null, $requestedName = null)
  34. {
  35. return $this($container, $requestedName ?: AdapterPluginManager::class, $this->creationOptions);
  36. }
  37. /**
  38. * zend-servicemanager v2 support for invocation options.
  39. *
  40. * @param array $options
  41. * @return void
  42. */
  43. public function setCreationOptions(array $options)
  44. {
  45. $this->creationOptions = $options;
  46. }
  47. }