当前位置: 首页>>代码示例>>PHP>>正文


PHP ReflectionProperty::setAccessible方法代码示例

本文整理汇总了PHP中ReflectionProperty::setAccessible方法的典型用法代码示例。如果您正苦于以下问题:PHP ReflectionProperty::setAccessible方法的具体用法?PHP ReflectionProperty::setAccessible怎么用?PHP ReflectionProperty::setAccessible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ReflectionProperty的用法示例。


在下文中一共展示了ReflectionProperty::setAccessible方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Constructor
  *
  * @param string $class
  * @param string $name
  */
 public function __construct($class, $name)
 {
     $this->class = $class;
     $this->name = $name;
     $this->reflection = new \ReflectionProperty($class, $name);
     $this->reflection->setAccessible(true);
 }
开发者ID:novaway,项目名称:open-graph,代码行数:13,代码来源:PropertyMetadata.php

示例2: __construct

 /**
  * @param callable $callback
  */
 public function __construct(callable $callback)
 {
     $this->objects = new ArrayObject();
     $this->callback = $callback;
     $this->dataObjectRecordProperty = new ReflectionProperty('DataObject', 'record');
     $this->dataObjectRecordProperty->setAccessible(true);
 }
开发者ID:helpfulrobot,项目名称:littlegiant-silverstripe-batchwrite,代码行数:10,代码来源:OnAfterExists.php

示例3: _setConnectionOnInstaller

 /**
  * Force connection setter injection on setup model using reflection
  * 
  * @param $setup
  * @param $connection
  */
 protected function _setConnectionOnInstaller($setup, $connection)
 {
     $prop = new ReflectionProperty($setup, '_conn');
     $prop->setAccessible(true);
     $prop->setValue($setup, $connection);
     $prop->setAccessible(false);
 }
开发者ID:gewaechshaus,项目名称:groupscatalog2,代码行数:13,代码来源:SetupTest.php

示例4: __construct

 /**
  * @param int $batchSize
  */
 public function __construct($batchSize = 100)
 {
     $this->batch = new Batch();
     $this->batchSize = $batchSize;
     $this->dataObjectRecordProperty = new ReflectionProperty('DataObject', 'record');
     $this->dataObjectRecordProperty->setAccessible(true);
 }
开发者ID:helpfulrobot,项目名称:littlegiant-silverstripe-batchwrite,代码行数:10,代码来源:BatchedWriter.php

示例5: __construct

 /**
  *
  */
 public function __construct()
 {
     $this->connProperty = new ReflectionProperty('MySQLDatabase', 'dbConn');
     $this->connProperty->setAccessible(true);
     $this->dataObjectRecordProperty = new ReflectionProperty('DataObject', 'record');
     $this->dataObjectRecordProperty->setAccessible(true);
 }
开发者ID:helpfulrobot,项目名称:littlegiant-silverstripe-batchwrite,代码行数:10,代码来源:Batch.php

示例6: resetProperty

 protected function resetProperty($name, $value = null)
 {
     $prop = new ReflectionProperty('Valitron\\Validator', $name);
     $prop->setAccessible(true);
     $prop->setValue($value);
     $prop->setAccessible(false);
 }
开发者ID:rschraml,项目名称:UserFrosting,代码行数:7,代码来源:BaseTestCase.php

示例7: enableOpenSSL

 private function enableOpenSSL()
 {
     $ref = new \ReflectionProperty('Bitpay\\Util\\SecureRandom', 'hasOpenSSL');
     $ref->setAccessible(true);
     $ref->setValue(null);
     $ref->setAccessible(false);
 }
开发者ID:bitpay,项目名称:php-client,代码行数:7,代码来源:SecureRandomTest.php

示例8: writeAttribute

 /**
  * @param string|object $classOrObject
  * @param string        $attributeName
  * @param mixed         $attributeValue
  */
 public function writeAttribute($classOrObject, $attributeName, $attributeValue)
 {
     $rp = new \ReflectionProperty($classOrObject, $attributeName);
     $rp->setAccessible(true);
     $rp->setValue($classOrObject, $attributeValue);
     $rp->setAccessible(false);
 }
开发者ID:ruslan-polutsygan,项目名称:dev-bundle,代码行数:12,代码来源:WriteAttributeExtensionTrait.php

示例9: createRecurringOrder

 protected function createRecurringOrder()
 {
     $order = new Order();
     $customer = new Partner();
     $order->setOwner($customer);
     $product1 = new Product();
     $product1->setName('product1');
     $context = new PricingContext();
     $recurringElement = new RecurringElement();
     $recurringElement->setCycles(-1);
     $recurringElement->setInterval('1 month');
     $recurringElement->setRecurringCharge('30');
     $pricingSet = new PricingSet(new TotalValueElement());
     $pricingSet->addPricingElement($recurringElement);
     $pricingSet->setProcessingState(PricingSet::PROCESSING_FINISHED);
     $pricingSet1 = $pricingSet->process($context);
     $orderItem1 = new Item($product1);
     $rp = new \ReflectionProperty($orderItem1, 'pricingSet');
     $rp->setAccessible(true);
     $rp->setValue($orderItem1, $pricingSet1);
     $rp->setAccessible(false);
     $rm = new \ReflectionMethod($order, 'addItem');
     $rm->setAccessible(true);
     $rm->invokeArgs($order, array($orderItem1));
     $rm->setAccessible(false);
     return $order;
 }
开发者ID:vespolina,项目名称:commerce,代码行数:27,代码来源:DefaultBillingRequestGeneratorTest.php

示例10: setUp

 protected function setUp()
 {
     $this->cacheDataReflection = new \ReflectionProperty("Doctrine\\Common\\Cache\\ArrayCache", "data");
     $this->cacheDataReflection->setAccessible(true);
     $this->useModelSet('cms');
     parent::setUp();
 }
开发者ID:selimcr,项目名称:servigases,代码行数:7,代码来源:QueryCacheTest.php

示例11: checkAccess

 private function checkAccess()
 {
     if (!$this->isAccessible) {
         $this->reflectionProperty->setAccessible(true);
     }
     $this->isAccessible = true;
 }
开发者ID:graphaware,项目名称:neo4j-php-ogm,代码行数:7,代码来源:EntityPropertyMetadata.php

示例12: tearDown

 public function tearDown()
 {
     $property = new \ReflectionProperty('\\Magento\\Setup\\Module\\I18n\\ServiceLocator', '_dictionaryGenerator');
     $property->setAccessible(true);
     $property->setValue(null);
     $property->setAccessible(false);
 }
开发者ID:hientruong90,项目名称:magento2_installer,代码行数:7,代码来源:I18nCollectPhrasesCommandTest.php

示例13: setConnAccessible

 private static function setConnAccessible()
 {
     if (!self::$connRefl) {
         self::$connRefl = new \ReflectionProperty('\\React\\Http\\Response', 'conn');
         self::$connRefl->setAccessible(true);
     }
 }
开发者ID:unkerror,项目名称:Budabot,代码行数:7,代码来源:Response.php

示例14: __construct

 /**
  * Constructor
  * @param \PHP_CodeSniffer_File $phpcsFile
  */
 public function __construct(PHP_CodeSniffer_File $phpcsFile)
 {
     $this->phpcsFile = $phpcsFile;
     $this->reflection = new ReflectionProperty($this->phpcsFile, 'ruleset');
     $this->reflection->setAccessible(true);
     $this->current = $this->reflection->getValue($this->phpcsFile);
     $this->backup = $this->current;
 }
开发者ID:gamegos,项目名称:php-code-sniffer,代码行数:12,代码来源:RulesetHelper.php

示例15: getWriter

 /**
  * @return Writer
  */
 protected function getWriter()
 {
     if (null == $this->refField) {
         $this->refField = new \ReflectionProperty(get_parent_class($this), 'writer');
         $this->refField->setAccessible(true);
     }
     return $this->refField->getValue($this);
 }
开发者ID:Maksold,项目名称:platform,代码行数:11,代码来源:Visitor.php


注:本文中的ReflectionProperty::setAccessible方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。