WriterPluginManager.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /**
  3. * Zend Framework (http://framework.zend.com/)
  4. *
  5. * @link http://github.com/zendframework/zf2 for the canonical source repository
  6. * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
  7. * @license http://framework.zend.com/license/new-bsd New BSD License
  8. */
  9. namespace Zend\Config;
  10. use Zend\ServiceManager\AbstractPluginManager;
  11. class WriterPluginManager extends AbstractPluginManager
  12. {
  13. protected $invokableClasses = array(
  14. 'php' => 'Zend\Config\Writer\PhpArray',
  15. 'ini' => 'Zend\Config\Writer\Ini',
  16. 'json' => 'Zend\Config\Writer\Json',
  17. 'yaml' => 'Zend\Config\Writer\Yaml',
  18. 'xml' => 'Zend\Config\Writer\Xml',
  19. );
  20. public function validatePlugin($plugin)
  21. {
  22. if ($plugin instanceOf Writer\AbstractWriter) {
  23. return;
  24. }
  25. $type = is_object($plugin) ? get_class($plugin) : gettype($plugin);
  26. throw new Exception\InvalidArgumentException(
  27. "Plugin of type {$type} is invalid. Plugin must extend ".
  28. __NAMESPACE__.'\Writer\AbstractWriter'
  29. );
  30. }
  31. }