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


PHP ReflectionObject::getMethod方法代码示例

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


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

示例1: testProtectedMethods

 /**
  * Test Clone
  */
 public function testProtectedMethods()
 {
     $result = ConcreteSingleton::getInstance();
     $reflection = new \ReflectionObject($result);
     $this->assertTrue($reflection->getMethod('__construct')->isProtected());
     $this->assertTrue($reflection->getMethod('__clone')->isProtected());
 }
开发者ID:dezvell,项目名称:mm.local,代码行数:10,代码来源:SingletonTest.php

示例2: instanceMapFrom

 /**
  * @param FormField $formField
  * @param KForm     $form
  */
 public function instanceMapFrom(FormField $formField, KForm $form)
 {
     $attribute = $formField->getFieldName();
     $method = 'mappingFromFormField' . ucfirst($attribute);
     if ($this->instanceReflector->hasMethod($method)) {
         $methodReflector = $this->instanceReflector->getMethod($method);
         $parameters = array();
         foreach ($methodReflector->getParameters() as $paramReflector) {
             switch (true) {
                 case $paramReflector->getClass()->isSubclassOf(KForm::class):
                     $parameters[] = $form;
                     break;
                 case $paramReflector->getClass()->isSubclassOf(FormField::class):
                     $parameters[] = $formField;
                     break;
                 default:
                     $parameters[] = $formField;
                     break;
             }
         }
         call_user_func_array(array($this->instance, $method), $parameters);
     } else {
         $this->instance->{$attribute} = $formField->getValue();
     }
 }
开发者ID:xjtuwangke,项目名称:laravel-bundles,代码行数:29,代码来源:SingleEloquentInstance.php

示例3: __call

 public function __call($method, $args)
 {
     if (!method_exists($this->entity, $method) or !is_callable(array($this->entity, $method))) {
         throw new OvoCommonException('Method ' . $method . ' not exists or is not public');
     }
     $value = $this->reflectionObject->getMethod($method)->invokeArgs($this->entity, $args);
     if ($value == null) {
         $value = $this;
     }
     return $value;
 }
开发者ID:db80,项目名称:ovo-common,代码行数:11,代码来源:Chainable.php

示例4: testProcessTaggedPlugins

 public function testProcessTaggedPlugins()
 {
     $r = new \ReflectionObject($this->compiler);
     $m = $r->getMethod('processTaggedDeployers');
     $m->setAccessible(true);
     $m->invoke($this->compiler, $this->getFakeContainer());
     $m = $r->getMethod('getDeployer');
     $m->setAccessible(true);
     $result = $m->invoke($this->compiler, 'test');
     $this->assertEquals($result, 'deployer.test');
 }
开发者ID:skedone,项目名称:DeployBundle,代码行数:11,代码来源:DeployersCompilerPassTest.php

示例5: testGetRedisObject

 /**
  * @see \Endeveit\Cache\Drivers\Redis::getRedisObject()
  */
 public function testGetRedisObject()
 {
     $method = self::$driverReflection->getMethod('getRedisObject');
     $method->setAccessible(true);
     $property = self::$driverReflection->getProperty('connectionsOptions');
     $property->setAccessible(true);
     $options = $property->getValue(self::$driver);
     $this->assertCount(2, $options);
     foreach (array_keys($options) as $key) {
         $this->assertInstanceOf('Redis', $method->invoke(self::$driver, $key));
     }
 }
开发者ID:endeveit,项目名称:cache,代码行数:15,代码来源:RedisTest.php

示例6: runController

 public function runController($cName, $aName, $params)
 {
     $theController = new $cName();
     $reflection_object = new ReflectionObject($theController);
     if ($reflection_object->hasMethod('before_action')) {
         $reflection_object->getMethod('before_action')->invoke($theController);
     }
     call_user_func_array(array($theController, $aName), $params);
     if ($reflection_object->hasMethod('after_action')) {
         $reflection_object->getMethod('after_action')->invoke($theController);
     }
 }
开发者ID:reny-ahmad,项目名称:WayangCMS,代码行数:12,代码来源:WY_Bootstrap.php

示例7: remap

 public function remap()
 {
     $ci =& get_instance();
     $method = $ci->uri->rsegment(2);
     $parameters = array_slice($ci->uri->rsegment_array(), 2);
     $reflection = new ReflectionObject($ci);
     if ($reflection->hasMethod($method)) {
         $reflection->getMethod($method)->invokeArgs($ci, $parameters);
     } else {
         array_splice($parameters, 0, 0, $method);
         $reflection->getMethod("index")->invokeArgs($ci, $parameters);
     }
 }
开发者ID:fajarantono,项目名称:distroApp,代码行数:13,代码来源:indexfixer.php

示例8: __construct

 public function __construct()
 {
     $this->context = AgaviContext::getInstance();
     $this->parser = new AppKitFormatParserUtil();
     $p =& $this->parser;
     $p->registerNamespace('xmlfn', AppKitFormatParserUtil::TYPE_METHOD);
     $ref = new ReflectionObject($this);
     // Register some methods
     $p->registerMethod('xmlfn', 'author', array(&$this, $ref->getMethod('valueAuthor')));
     $p->registerMethod('xmlfn', 'instance', array(&$this, $ref->getMethod('valueDefaultInstance')));
     $p->registerMethod('xmlfn', 'pagerMaxItems', array(&$this, $ref->getMethod('pagerMaxItems')));
     $p->registerMethod('xmlfn', 'autoRefreshTime', array(&$this, $ref->getMethod('autoRefreshTime')));
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:13,代码来源:CronkGridTemplateXmlReplace.class.php

示例9: testLockReleased

 public function testLockReleased()
 {
     $locker = new FileLockStrategy(__DIR__ . '/../../../../../app/cache/queue-test.bin');
     $locker->clear();
     $rLocker = new \ReflectionObject($locker);
     $method = $rLocker->getMethod('getFile');
     $method->setAccessible(true);
     $file = $method->invoke($locker);
     $this->assertTrue(is_resource($file), true);
     $method2 = $rLocker->getMethod('releaseFile');
     $method2->setAccessible(true);
     $method2->invokeArgs($locker, [$file]);
     $file = $method->invoke($locker);
     $this->assertTrue(is_resource($file), true);
 }
开发者ID:naroga,项目名称:querker,代码行数:15,代码来源:FileLockStrategyTest.php

示例10: testNoConstructor

 public function testNoConstructor()
 {
     $obj = Singleton::getInstance();
     $refl = new \ReflectionObject($obj);
     $meth = $refl->getMethod('__construct');
     $this->assertTrue($meth->isPrivate());
 }
开发者ID:xtrasmal,项目名称:DesignPatternsPHP,代码行数:7,代码来源:SingletonTest.php

示例11: testBuildPath

 /**
  * Test build path.
  */
 public function testBuildPath()
 {
     $reflection_object = new \ReflectionObject($this->client);
     $reflection_method = $reflection_object->getMethod('buildPath');
     $reflection_method->setAccessible(TRUE);
     $this->assertEquals($reflection_method->invoke($this->client), 'HNK2IC/F_jM8Zls30dL/guid/-/2849493');
 }
开发者ID:robcolburn,项目名称:mpx-php,代码行数:10,代码来源:FeedMediaClientTest.php

示例12: execute

 public static function execute($commande, $params)
 {
     session_start();
     $endpoint=new static();
     
     $commande = "API_".$commande;
     
     
     $endpointReflx = new ReflectionObject($endpoint);
     $methodReflx = $endpointReflx->getMethod($commande);
     try{
         $result =$methodReflx->invokeArgs($endpoint, $params);
         
         $result = [
             'status'=>'success',
             'value'=>$result
         ];
         
     }
     catch(ErrorException $ex)
     {
         $result = [
             'status'=>'error',
             'value'=>$ex->getMessage()
         ];
     }
     session_commit();
     return $result;
 }
开发者ID:RomLAURENT,项目名称:Jar2Fer,代码行数:29,代码来源:api.php

示例13: testFilterResponseConvertsCookies

    public function testFilterResponseConvertsCookies()
    {
        $client = new Client(new TestHttpKernel());

        $r = new \ReflectionObject($client);
        $m = $r->getMethod('filterResponse');
        $m->setAccessible(true);

        $expected = array(
            'foo=bar; expires=Sun, 15 Feb 2009 20:00:00 GMT; domain=http://example.com; path=/foo; secure; httponly',
            'foo1=bar1; expires=Sun, 15 Feb 2009 20:00:00 GMT; domain=http://example.com; path=/foo; secure; httponly'
        );

        $response = new Response();
        $response->headers->setCookie(new Cookie('foo', 'bar', \DateTime::createFromFormat('j-M-Y H:i:s T', '15-Feb-2009 20:00:00 GMT')->format('U'), '/foo', 'http://example.com', true, true));
        $domResponse = $m->invoke($client, $response);
        $this->assertEquals($expected[0], $domResponse->getHeader('Set-Cookie'));

        $response = new Response();
        $response->headers->setCookie(new Cookie('foo', 'bar', \DateTime::createFromFormat('j-M-Y H:i:s T', '15-Feb-2009 20:00:00 GMT')->format('U'), '/foo', 'http://example.com', true, true));
        $response->headers->setCookie(new Cookie('foo1', 'bar1', \DateTime::createFromFormat('j-M-Y H:i:s T', '15-Feb-2009 20:00:00 GMT')->format('U'), '/foo', 'http://example.com', true, true));
        $domResponse = $m->invoke($client, $response);
        $this->assertEquals($expected[0], $domResponse->getHeader('Set-Cookie'));
        $this->assertEquals($expected, $domResponse->getHeader('Set-Cookie', false));
    }
开发者ID:usefulthink,项目名称:symfony,代码行数:25,代码来源:ClientTest.php

示例14: testCommitNeedNotification

 public function testCommitNeedNotification()
 {
     $notifier = $this->getMock('Sismo\\Contrib\\CrossFingerNotifier');
     $r = new \ReflectionObject($notifier);
     $m = $r->getMethod('commitNeedNotification');
     $m->setAccessible(true);
     $project = new Project('Twig');
     $commit = new Commit($project, '123456');
     $commit->setAuthor('Fabien');
     $commit->setMessage('Foo');
     $commit2 = new Commit($project, '123455');
     $commit2->setAuthor('Fabien');
     $commit2->setMessage('Bar');
     $commit2->setStatusCode('success');
     $commit3 = clone $commit2;
     //a failed commit should be notified
     $this->assertTrue($m->invoke($notifier, $commit));
     //a successful commit without predecessor should be notified
     $this->assertTrue($m->invoke($notifier, $commit2));
     $project->setCommits(array($commit3));
     //a successful commit with a successful predecessor should NOT be notified
     $this->assertFalse($m->invoke($notifier, $commit2));
     $project->setCommits(array($commit2, $commit3));
     //a failed commit with a successful predecessor should be notified
     $this->assertTrue($m->invoke($notifier, $commit));
 }
开发者ID:hyperlator,项目名称:Sismo,代码行数:26,代码来源:CrossFingerNotifierTest.php

示例15: callProtectedMethod

 protected function callProtectedMethod($object, $method, array $args = array())
 {
     $reflectedObject = new \ReflectionObject($object);
     $reflectedMethod = $reflectedObject->getMethod($method);
     $reflectedMethod->setAccessible(true);
     return $reflectedMethod->invokeArgs($object, $args);
 }
开发者ID:romainneutron,项目名称:aws-sdk-php,代码行数:7,代码来源:AbstractTransferTest.php


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