• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP SimpleReflection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ignoreParentsIfIgnored

 /**
  *    Scans the now complete ignore list, and adds
  *    all parent classes to the list. If a class
  *    is not a runnable test case, then it's parents
  *    wouldn't be either. This is syntactic sugar
  *    to cut down on ommissions of ignore()'s or
  *    missing abstract declarations. This cannot
  *    be done whilst loading classes wiithout forcing
  *    a particular order on the class declarations and
  *    the ignore() calls. It's just nice to have the ignore()
  *    calls at the top of the file before the actual declarations.
  *    @param array $classes     Class names of interest.
  *    @static
  *    @access public
  */
 function ignoreParentsIfIgnored($classes) {
     $registry = &SimpleTest::_getRegistry();
     foreach ($classes as $class) {
         if (SimpleTest::isIgnored($class)) {
             $reflection = new SimpleReflection($class);
             if ($parent = $reflection->getParent()) {
                 SimpleTest::ignore($parent);
             }
         }
     }
 }
开发者ID:nuckey,项目名称:moodle,代码行数:26,代码来源:simpletest.php


示例2: ignoreParentsIfIgnored

 /**
  *    Scans the now complete ignore list, and adds
  *    all parent classes to the list. If a class
  *    is not a runnable test case, then it's parents
  *    wouldn't be either. This is syntactic sugar
  *    to cut down on ommissions of ignore()'s or
  *    missing abstract declarations. This cannot
  *    be done whilst loading classes wiithout forcing
  *    a particular order on the class declarations and
  *    the ignore() calls. It's just nice to have the ignore()
  *    calls at the top of the file before the actual declarations.
  *    @param array $classes     Class names of interest.
  */
 public static function ignoreParentsIfIgnored($classes)
 {
     foreach ($classes as $class) {
         if (SimpleTest::isIgnored($class)) {
             $reflection = new SimpleReflection($class);
             $parent = $reflection->getParent();
             if ($parent) {
                 SimpleTest::ignore($parent);
             }
         }
     }
 }
开发者ID:ilune,项目名称:simpletest,代码行数:25,代码来源:simpletest.php


示例3: testMostGeneralPossibleSignature

 function testMostGeneralPossibleSignature()
 {
     $reflection = new SimpleReflection('AnyOldThing');
     $this->assertEqualIgnoringCase($reflection->getSignature('aMethod'), 'function &aMethod()');
 }
开发者ID:ljarray,项目名称:dbpedia,代码行数:5,代码来源:reflection_php4_test.php


示例4: testParameterCreationForTypeHinting

 function testParameterCreationForTypeHinting()
 {
     $reflection = new SimpleReflection('AnyOldTypeHintedClass');
     $function = $reflection->getSignature('aMethod');
     if (version_compare(phpversion(), '5.0.2', '<=')) {
         $this->assertEqual('function amethod(AnyOldInterface $argument)', $function);
     } else {
         $this->assertEqual('function aMethod(AnyOldInterface $argument)', $function);
     }
 }
开发者ID:PublicityPort,项目名称:OpenCATS,代码行数:10,代码来源:reflection_php5_test.php


示例5: _createHandlerCode

 /**
  *    Creates code within a class to generate replaced
  *    methods. All methods call the _invoke() handler
  *    with the method name and the arguments in an
  *    array.
  *    @param array $methods    Additional methods.
  *    @access private
  */
 function _createHandlerCode($methods)
 {
     $code = '';
     $methods = array_merge($methods, $this->_reflection->getMethods());
     foreach ($methods as $method) {
         if ($this->_isConstructor($method)) {
             continue;
         }
         $mock_reflection = new SimpleReflection($this->_mock_base);
         if (in_array($method, $mock_reflection->getMethods())) {
             continue;
         }
         $code .= "    " . $this->_reflection->getSignature($method) . " {\n";
         $code .= "        \$args = func_get_args();\n";
         $code .= "        \$result = &\$this->_invoke(\"{$method}\", \$args);\n";
         $code .= "        return \$result;\n";
         $code .= "    }\n";
     }
     return $code;
 }
开发者ID:sebs,项目名称:simpletest,代码行数:28,代码来源:mock_objects.php


示例6: testUnsetFunctionSignature

 function testUnsetFunctionSignature()
 {
     $reflection = new SimpleReflection('AnyOldOverloadedClass');
     $function = $reflection->getSignature('__unset');
     if (version_compare(phpversion(), '5.1.0', '>=')) {
         $this->assertEqual('function __unset($key)', $function);
     } else {
         $this->assertEqual('function __unset()', $function);
     }
 }
开发者ID:BackupTheBerlios,项目名称:pic2base-svn,代码行数:10,代码来源:reflection_php5_test.php


示例7: selectRunnableTests

 /**
  *    Calculates the incoming test cases. Skips abstract
  *    and ignored classes.
  *    @param array $candidates   Candidate classes.
  *    @return array              New classes which are test
  *                               cases that shouldn't be ignored.
  *    @access public
  */
 function selectRunnableTests($candidates) {
     $classes = array();
     foreach ($candidates as $class) {
         if (TestSuite::getBaseTestCase($class)) {
             $reflection = new SimpleReflection($class);
             if ($reflection->isAbstract()) {
                 SimpleTest::ignore($class);
             } else {
                 $classes[] = $class;
             }
         }
     }
     return $classes;
 }
开发者ID:nuckey,项目名称:moodle,代码行数:22,代码来源:test_case.php


示例8: createNewMethodCode

 /**
  *    Creates code within a class to generate a new
  *    methods. All methods call the invoke() handler
  *    on the internal mock with the method name and
  *    the arguments in an array.
  *    @param array $methods    Additional methods.
  */
 protected function createNewMethodCode($methods)
 {
     $code = '';
     foreach ($methods as $method) {
         if ($this->isConstructor($method)) {
             continue;
         }
         $mock_reflection = new SimpleReflection($this->mock_base);
         if (in_array($method, $mock_reflection->getMethods())) {
             continue;
         }
         $code .= "    " . $this->reflection->getSignature($method) . " {\n";
         $code .= "        \$args = func_get_args();\n";
         $code .= "        \$result = &\$this->mock->invoke(\"{$method}\", \$args);\n";
         $code .= "        return \$result;\n";
         $code .= "    }\n";
     }
     return $code;
 }
开发者ID:Boris-de,项目名称:videodb,代码行数:26,代码来源:mock_objects.php


示例9: _selectRunnableTests

 /**
  *    Calculates the incoming test cases from a before
  *    and after list of loaded classes. Skips abstract
  *    classes.
  *    @param array $existing_classes   Classes before require().
  *    @param array $new_classes        Classes after require().
  *    @return array                    New classes which are test
  *                                     cases that shouldn't be ignored.
  *    @access private
  */
 function _selectRunnableTests($existing_classes, $new_classes)
 {
     $classes = array();
     foreach ($new_classes as $class) {
         if (in_array($class, $existing_classes)) {
             continue;
         }
         if ($this->_getBaseTestCase($class)) {
             $reflection = new SimpleReflection($class);
             if ($reflection->isAbstract()) {
                 SimpleTest::ignore($class);
             }
             $classes[] = $class;
         }
     }
     return $classes;
 }
开发者ID:sergrin,项目名称:crawlers-il,代码行数:27,代码来源:test_case.php


示例10: testCanProperlyGenerateAbstractMethods

 function testCanProperlyGenerateAbstractMethods()
 {
     $reflection = new SimpleReflection('AnyOldAbstractClassWithAbstractMethods');
     $this->assertEqual('function anAbstract()', $reflection->getSignature('anAbstract'));
     $this->assertEqual('function anAbstractWithParameter($foo)', $reflection->getSignature('anAbstractWithParameter'));
     $this->assertEqual('function anAbstractWithMultipleParameters($foo, $bar)', $reflection->getSignature('anAbstractWithMultipleParameters'));
 }
开发者ID:ready4god2513,项目名称:Journal,代码行数:7,代码来源:reflection_php5_test.php


示例11: testCopingWithSpecialMethodunsetPHP51

 function testCopingWithSpecialMethodunsetPHP51()
 {
     $reflection = new SimpleReflection('AnyOldClassInvokingMethodsWithArgumentsInConstructor');
     $this->assertEqual('function __unset($key)', $reflection->getSignature('__unset'));
     $this->assertEqual('function __unset($key)', $reflection->getSignature('__unset', SIG_GEN_DECLARE));
     $this->assertEqual('parent::__unset($key)', $reflection->getSignature('__unset', SIG_GEN_INVOKE_AS_PARENT));
     $this->expectError(new PatternExpectation('/Reflection does not \\(yet\\) support mode ' . SIG_GEN_ASSIGN_ONLY_THE_ARGS . ' for __unset/'));
     $this->assertEqual('$key', $reflection->getSignature('__unset', SIG_GEN_DECLARE_ONLY_THE_ARGS));
     $this->assertEqual('$key', $reflection->getSignature('__unset', SIG_GEN_INVOKE_ONLY_THE_ARGS));
     $this->assertEqual('', $reflection->getSignature('__unset', SIG_GEN_ASSIGN_ONLY_THE_ARGS));
     $this->expectError(new PatternExpectation('/Reflection does not \\(yet\\) support mode ' . SIG_GEN_ASSIGN_ONLY_THE_ARGS . ' for __unset/'));
     $this->expectError(new PatternExpectation('/Reflection does not \\(yet\\) support mode ' . SIG_GEN_ASSIGN_ONLY_THE_ARGS . ' for __unset/'));
     $this->expectError(new PatternExpectation('/Reflection does not \\(yet\\) support mode ' . SIG_GEN_ASSIGN_ONLY_THE_ARGS . ' for __unset/'));
     $this->assertEqual('function __unset($key)', $reflection->getSignature('__unset', SIG_GEN_DECLARE, array('assign' => array('arg1' => 'A10', 'arg2' => 'B20'))));
     $this->assertEqual('parent::__unset($key)', $reflection->getSignature('__unset', SIG_GEN_INVOKE_AS_PARENT, array('assign' => array('arg1' => 'A10', 'arg2' => 'B20'))));
     $this->assertEqual('', $reflection->getSignature('__unset', SIG_GEN_ASSIGN_ONLY_THE_ARGS, array('assign' => array('arg1' => 'A10', 'arg2' => 'B20'))));
     $this->assertEqual('PREFIX::$key::POSTFIX', $reflection->getSignature('__unset', SIG_GEN_DECLARE_ONLY_THE_ARGS, array('prefix' => 'PREFIX::', 'postfix' => '::POSTFIX')));
     $this->assertEqual('PREFIX::$key::POSTFIX', $reflection->getSignature('__unset', SIG_GEN_INVOKE_ONLY_THE_ARGS, array('prefix' => 'PREFIX::', 'postfix' => '::POSTFIX')));
     $this->assertEqual('', $reflection->getSignature('__unset', SIG_GEN_ASSIGN_ONLY_THE_ARGS, array('prefix' => 'PREFIX::', 'postfix' => '::POSTFIX')));
     $this->assertEqual('', $reflection->getSignature('__unset', SIG_GEN_ASSIGN_ONLY_THE_ARGS, array('assign' => array('arg1' => 'A10', 'arg2' => 'B20'), 'prefix' => 'PREFIX::', 'postfix' => '::POSTFIX')));
     $this->assertEqual('PREFIX::$key::POSTFIX', $reflection->getSignature('__unset', SIG_GEN_DECLARE_ONLY_THE_ARGS, array('assign' => array('arg1' => 'A10'), 'prefix' => 'PREFIX::', 'postfix' => '::POSTFIX')));
 }
开发者ID:GerHobbelt,项目名称:simpletest,代码行数:22,代码来源:reflection_test.php


示例12: selectRunnableTests

 /**
  *    Calculates the incoming test cases. Skips abstract
  *    and ignored classes.
  *    @param array $candidates   Candidate classes.
  *    @return array              New classes which are test
  *                               cases that shouldn't be ignored.
  *    @access public
  */
 function selectRunnableTests($candidates)
 {
     $classes = array();
     foreach ($candidates as $class) {
         if (TestSuite::getBaseTestCase($class)) {
             $reflection = new SimpleReflection($class);
             if ($reflection->isAbstract()) {
                 SimpleTest::ignore($class);
             } else {
                 // only pick classes which do have test methods we can run:
                 $methods = $reflection->getMethods();
                 foreach ($methods as $method) {
                     if (SimpleTestCase::isTest($class, $method)) {
                         $classes[] = $class;
                         break;
                     }
                 }
             }
         }
     }
     return $classes;
 }
开发者ID:GerHobbelt,项目名称:simpletest,代码行数:30,代码来源:test_case.php


示例13: testParameterCreationForTypeHinting

 function testParameterCreationForTypeHinting()
 {
     $reflection = new SimpleReflection('AnyOldTypeHintedClass');
     $function = $reflection->getSignature('aMethod');
     $this->assertEqual('function aMethod(SimpleTest $argument)', $function);
 }
开发者ID:sebs,项目名称:simpletest,代码行数:6,代码来源:reflection_php5_test.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP SimpleReporter类代码示例发布时间:2022-05-23
下一篇:
PHP SimplePie_Misc类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap