當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ReflectionMethod::setAccessible方法代碼示例

本文整理匯總了PHP中ReflectionMethod::setAccessible方法的典型用法代碼示例。如果您正苦於以下問題:PHP ReflectionMethod::setAccessible方法的具體用法?PHP ReflectionMethod::setAccessible怎麽用?PHP ReflectionMethod::setAccessible使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ReflectionMethod的用法示例。


在下文中一共展示了ReflectionMethod::setAccessible方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testUses

 public function testUses()
 {
     $usesMethod = new \ReflectionMethod($this->testInstance, 'uses');
     $usesMethod->setAccessible(true);
     $this->assertSame(['Illuminate\\Translation\\TranslationServiceProvider'], $usesMethod->invoke($this->testInstance));
     $usesMethod->setAccessible(false);
 }
開發者ID:laravel-commode,項目名稱:validation-locator,代碼行數:7,代碼來源:ValidationLocatorServiceProviderTest.php

示例2: testFacade

 public function testFacade()
 {
     $accessorMethod = new \ReflectionMethod(NavigationBagFacade::class, 'getFacadeAccessor');
     $accessorMethod->setAccessible(true);
     $this->assertSame(NavigationBagServiceProvider::PROVIDES_SERVICE, $accessorMethod->invoke(null));
     $accessorMethod->setAccessible(false);
 }
開發者ID:laravel-commode,項目名稱:navigation-bag,代碼行數:7,代碼來源:NavigationBagFacadeTest.php

示例3: testUses

 public function testUses()
 {
     $reflectionMethod = new \ReflectionMethod($this->testInstance, 'uses');
     $reflectionMethod->setAccessible(true);
     $this->assertSame([ValidationLocatorServiceProvider::class], $reflectionMethod->invoke($this->testInstance));
     $reflectionMethod->setAccessible(false);
 }
開發者ID:laravel-commode,項目名稱:viewmodel,代碼行數:7,代碼來源:ViewModelServiceProviderTest.php

示例4: testAccessor

 public function testAccessor()
 {
     $method = new \ReflectionMethod(ValidationLocator::class, 'getFacadeAccessor');
     $method->setAccessible(true);
     $this->assertSame(ValidationLocatorServiceProvider::PROVIDES_LOCATOR, $method->invoke(null));
     $method->setAccessible(false);
 }
開發者ID:laravel-commode,項目名稱:validation-locator,代碼行數:7,代碼來源:ValidationLocatorTest.php

示例5: testUses

 public function testUses()
 {
     $usesMethod = new \ReflectionMethod($this->testInstance, 'uses');
     $usesMethod->setAccessible(true);
     $this->assertSame([SessionServiceProvider::class, RoutingServiceProvider::class], $usesMethod->invoke($this->testInstance));
     $usesMethod->setAccessible(false);
 }
開發者ID:laravel-commode,項目名稱:navigation-bag,代碼行數:7,代碼來源:NavigationBagServiceProviderTest.php

示例6: setSetterMethod

 /**
  * @param \ReflectionMethod $setterMethod
  */
 public function setSetterMethod($setterMethod)
 {
     $this->setterMethod = $setterMethod;
     if ($this->setterMethod) {
         $this->setterMethod->setAccessible(TRUE);
     }
 }
開發者ID:20steps,項目名稱:autotables-bundle,代碼行數:10,代碼來源:MethodColumnDescriptor.php

示例7: testAccessor

 public function testAccessor()
 {
     $reflectionMethod = new \ReflectionMethod(BladedFacade::class, 'getFacadeAccessor');
     $reflectionMethod->setAccessible(true);
     $this->assertSame(BladedServiceProvider::PROVIDES_SERVICE, $reflectionMethod->invoke(null));
     $reflectionMethod->setAccessible(false);
 }
開發者ID:laravel-commode,項目名稱:bladed,代碼行數:7,代碼來源:BladedFacadeTest.php

示例8: __construct

 /**
  * Constructor
  *
  * @param string $class
  * @param string $name
  */
 public function __construct($class, $name)
 {
     $this->class = $class;
     $this->name = $name;
     $this->reflection = new \ReflectionMethod($class, $name);
     $this->reflection->setAccessible(true);
 }
開發者ID:novaway,項目名稱:open-graph,代碼行數:13,代碼來源:MethodMetadata.php

示例9: testGetLastChildKey

 /**
  * Test the sanity check for behaviour on empty children list
  * which should never happen as this is protected method
  */
 public function testGetLastChildKey()
 {
     $object = JsonNode::factory(array());
     $method = new \ReflectionMethod($object, 'getLastChildKey');
     $method->setAccessible(true);
     $this->assertNull($method->invoke($object));
     $method->setAccessible(false);
 }
開發者ID:sammuelyee,項目名稱:facebook-php-ads-sdk,代碼行數:12,代碼來源:JsonNodeTest.php

示例10: __construct

 public function __construct(PropertyAnnotation $annotation, \ReflectionMethod $reflection)
 {
     $this->reflection = $reflection;
     $this->annotation = $annotation;
     if ($this->reflection->isPrivate() || $this->reflection->isProtected()) {
         $this->reflection->setAccessible(true);
     }
 }
開發者ID:agnetsolutions,項目名稱:common,代碼行數:8,代碼來源:DefaultMethodMetadata.php

示例11: setup

 public function setup()
 {
     $class = new \ReflectionClass('BsbFlysystemTest\\Assets\\SimpleAdapterFactory');
     $this->property = $class->getProperty('options');
     $this->property->setAccessible(true);
     $this->method = $class->getMethod('mergeMvcConfig');
     $this->method->setAccessible(true);
 }
開發者ID:stefanotorresi,項目名稱:BsbFlysystem,代碼行數:8,代碼來源:AbstractAdapterFactoryTest.php

示例12: setUp

 /**
  * Set up
  */
 protected function setUp()
 {
     require_once 'Fixtures/ConditionMatcherUserFuncs.php';
     $this->backupApplicationContext = GeneralUtility::getApplicationContext();
     $this->conditionMatcher = $this->getMockForAbstractClass(AbstractConditionMatcher::class);
     $this->evaluateConditionCommonMethod = new \ReflectionMethod(AbstractConditionMatcher::class, 'evaluateConditionCommon');
     $this->evaluateConditionCommonMethod->setAccessible(TRUE);
 }
開發者ID:plan2net,項目名稱:TYPO3.CMS,代碼行數:11,代碼來源:AbstractConditionMatcherTest.php

示例13: testGetFormTypeFqcn

 /**
  * @dataProvider shortTypesToFqcnProvider
  */
 public function testGetFormTypeFqcn($shortType, $expected)
 {
     $configuratorMock = $this->getMockBuilder('JavierEguiluz\\Bundle\\EasyAdminBundle\\Configuration\\Configurator')->disableOriginalConstructor()->getMock();
     $type = new EasyAdminFormType($configuratorMock, array(), array());
     $method = new \ReflectionMethod($type, 'getFormTypeFqcn');
     $method->setAccessible(true);
     $this->assertSame($expected, $method->invoke($type, $shortType));
     $method->setAccessible(false);
 }
開發者ID:sebastianlp,項目名稱:EasyAdminBundle,代碼行數:12,代碼來源:EasyAdminFormTypeTest.php

示例14: setUp

 public function setUp()
 {
     parent::setUp();
     $this->orderByTrait = $this->getObjectForTrait(OrderByTrait::class);
     $this->queryBuilder = $this->prophesize(QueryBuilder::class);
     $reflectionClass = new \ReflectionClass($this->orderByTrait);
     $this->addOrderByFunction = $reflectionClass->getMethod('addOrderBy');
     $this->addOrderByFunction->setAccessible(true);
 }
開發者ID:ollietb,項目名稱:sulu,代碼行數:9,代碼來源:OrderByTraitTest.php

示例15: __construct

 /**
  * @param AclCheckerInterface $aclChecker
  * @param Stopwatch           $stopwatch
  */
 public function __construct(AclCheckerInterface $aclChecker, Stopwatch $stopwatch)
 {
     $this->getObjectToSecure = new \ReflectionMethod('Nuxia\\AclBundle\\Manager\\AclChecker', 'getObjectToSecure');
     $this->getObjectToSecure->setAccessible(true);
     $aclIdentifierProperty = new \ReflectionProperty('Nuxia\\AclBundle\\Manager\\AclChecker', 'aclIdentifier');
     $aclIdentifierProperty->setAccessible(true);
     $this->aclIdentifier = $aclIdentifierProperty->getValue($aclChecker);
     $this->aclChecker = $aclChecker;
     $this->stopwatch = $stopwatch;
     $this->checks = [];
 }
開發者ID:dragosprotung,項目名稱:AclBundle,代碼行數:15,代碼來源:AclCheckerCollector.php


注:本文中的ReflectionMethod::setAccessible方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。