[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch

title

Body

[close]

/vendor/zendframework/zend-stdlib/src/Hydrator/ -> HydratorPluginManager.php (source)

   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-2015 Zend Technologies USA Inc. (http://www.zend.com)
   7   * @license   http://framework.zend.com/license/new-bsd New BSD License
   8   */
   9  
  10  namespace Zend\Stdlib\Hydrator;
  11  
  12  use Zend\ServiceManager\AbstractPluginManager;
  13  use Zend\Stdlib\Exception;
  14  
  15  /**
  16   * Plugin manager implementation for hydrators.
  17   *
  18   * Enforces that adapters retrieved are instances of HydratorInterface
  19   */
  20  class HydratorPluginManager extends AbstractPluginManager
  21  {
  22      /**
  23       * Whether or not to share by default
  24       *
  25       * @var bool
  26       */
  27      protected $shareByDefault = false;
  28  
  29      /**
  30       * Default aliases
  31       *
  32       * @var array
  33       */
  34      protected $aliases = array(
  35          'delegatinghydrator' => 'Zend\Stdlib\Hydrator\DelegatingHydrator',
  36      );
  37  
  38      /**
  39       * Default set of adapters
  40       *
  41       * @var array
  42       */
  43      protected $invokableClasses = array(
  44          'arrayserializable' => 'Zend\Stdlib\Hydrator\ArraySerializable',
  45          'classmethods'      => 'Zend\Stdlib\Hydrator\ClassMethods',
  46          'objectproperty'    => 'Zend\Stdlib\Hydrator\ObjectProperty',
  47          'reflection'        => 'Zend\Stdlib\Hydrator\Reflection'
  48      );
  49  
  50      /**
  51       * Default factory-based adapters
  52       *
  53       * @var array
  54       */
  55      protected $factories = array(
  56          'Zend\Stdlib\Hydrator\DelegatingHydrator' => 'Zend\Stdlib\Hydrator\DelegatingHydratorFactory',
  57      );
  58  
  59      /**
  60       * {@inheritDoc}
  61       */
  62      public function validatePlugin($plugin)
  63      {
  64          if ($plugin instanceof HydratorInterface) {
  65              // we're okay
  66              return;
  67          }
  68  
  69          throw new Exception\RuntimeException(sprintf(
  70              'Plugin of type %s is invalid; must implement Zend\Stdlib\Hydrator\HydratorInterface',
  71              (is_object($plugin) ? get_class($plugin) : gettype($plugin))
  72          ));
  73      }
  74  }


Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1