本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例6: resetProperty
protected function resetProperty($name, $value = null)
{
$prop = new ReflectionProperty('Valitron\\Validator', $name);
$prop->setAccessible(true);
$prop->setValue($value);
$prop->setAccessible(false);
}
示例7: enableOpenSSL
private function enableOpenSSL()
{
$ref = new \ReflectionProperty('Bitpay\\Util\\SecureRandom', 'hasOpenSSL');
$ref->setAccessible(true);
$ref->setValue(null);
$ref->setAccessible(false);
}
示例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);
}
示例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;
}
示例10: setUp
protected function setUp()
{
$this->cacheDataReflection = new \ReflectionProperty("Doctrine\\Common\\Cache\\ArrayCache", "data");
$this->cacheDataReflection->setAccessible(true);
$this->useModelSet('cms');
parent::setUp();
}
示例11: checkAccess
private function checkAccess()
{
if (!$this->isAccessible) {
$this->reflectionProperty->setAccessible(true);
}
$this->isAccessible = true;
}
示例12: tearDown
public function tearDown()
{
$property = new \ReflectionProperty('\\Magento\\Setup\\Module\\I18n\\ServiceLocator', '_dictionaryGenerator');
$property->setAccessible(true);
$property->setValue(null);
$property->setAccessible(false);
}
示例13: setConnAccessible
private static function setConnAccessible()
{
if (!self::$connRefl) {
self::$connRefl = new \ReflectionProperty('\\React\\Http\\Response', 'conn');
self::$connRefl->setAccessible(true);
}
}
示例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;
}
示例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);
}