[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/PropertyGenerator/ -> PrivatePropertiesMap.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 initializer for a lazy object
  13   *
  14   * @author Marco Pivetta <ocramius@gmail.com>
  15   * @license MIT
  16   */
  17  class PrivatePropertiesMap 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('privateProperties')
  32          );
  33  
  34          $this->setVisibility(self::VISIBILITY_PRIVATE);
  35          $this->setStatic(true);
  36          $this->setDocBlock(
  37              '@var array[][] visibility and default value of defined properties, indexed by property name and class name'
  38          );
  39          $this->setDefaultValue($this->getMap($properties));
  40      }
  41  
  42      /**
  43       * @param Properties $properties
  44       *
  45       * @return int[][]|mixed[][]
  46       */
  47      private function getMap(Properties $properties) : array
  48      {
  49          $map = [];
  50  
  51          foreach ($properties->getPrivateProperties() as $property) {
  52              $propertyKey = & $map[$property->getName()];
  53  
  54              $propertyKey[$property->getDeclaringClass()->getName()] = true;
  55          }
  56  
  57          return $map;
  58      }
  59  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1