[ Index ]

PHP Cross Reference of phpBB-3.3.11-deutsch

title

Body

[close]

/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/PropertyGenerator/ -> ProtectedPropertiesMap.php (source)

   1  <?php
   2  
   3  declare(strict_types=1);
   4  
   5  namespace ProxyManager\ProxyGenerator\LazyLoadingGhost\PropertyGenerator;
   6  
   7  use ProxyManager\Generator\Util\IdentifierSuffixer;
   8  use ProxyManager\ProxyGenerator\Util\Properties;
   9  use Zend\Code\Generator\PropertyGenerator;
  10  
  11  /**
  12   * Property that contains the protected instance lazy-loadable properties of an object
  13   *
  14   * @author Marco Pivetta <ocramius@gmail.com>
  15   * @license MIT
  16   */
  17  class ProtectedPropertiesMap extends PropertyGenerator
  18  {
  19      const KEY_DEFAULT_VALUE = 'defaultValue';
  20  
  21      /**
  22       * Constructor
  23       *
  24       * @param Properties $properties
  25       *
  26       * @throws \Zend\Code\Generator\Exception\InvalidArgumentException
  27       */
  28      public function __construct(Properties $properties)
  29      {
  30          parent::__construct(
  31              IdentifierSuffixer::getIdentifier('protectedProperties')
  32          );
  33  
  34          $this->setVisibility(self::VISIBILITY_PRIVATE);
  35          $this->setStatic(true);
  36          $this->setDocBlock(
  37              '@var string[][] declaring class name of defined protected properties, indexed by property name'
  38          );
  39          $this->setDefaultValue($this->getMap($properties));
  40      }
  41  
  42      /**
  43       *
  44       * @param Properties $properties
  45       *
  46       * @return int[][]|mixed[][]
  47       */
  48      private function getMap(Properties $properties) : array
  49      {
  50          $map = [];
  51  
  52          foreach ($properties->getProtectedProperties() as $property) {
  53              $map[$property->getName()] = $property->getDeclaringClass()->getName();
  54          }
  55  
  56          return $map;
  57      }
  58  }


Generated: Sat Nov 4 14:26:03 2023 Cross-referenced by PHPXref 0.7.1