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


PHP XPClass::isSubclassOf方法代码示例

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


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

示例1: register

 /**
  * Register transport implementation for a specific scheme
  *
  * @param   string scheme
  * @param   lang.XPClass<peer.http.HttpTransport> class
  */
 public static function register($scheme, XPClass $class)
 {
     if (!$class->isSubclassOf('peer.http.HttpTransport')) {
         throw new IllegalArgumentException(sprintf('Given argument must be lang.XPClass<peer.http.HttpTransport>, %s given', $class->toString()));
     }
     self::$transports[$scheme] = $class;
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:13,代码来源:HttpTransport.class.php

示例2: register

 /**
  * Register an implementation
  *
  * @param   string algorithm
  * @param   lang.XPClass<security.checksum.MessageDigestImpl> class
  * @throws  lang.IllegalArgumentException
  */
 public static function register($algorithm, XPClass $impl)
 {
     if (!$impl->isSubclassOf('security.checksum.MessageDigestImpl')) {
         throw new IllegalArgumentException('Implementation class must be a security.checksum.MessageDigestImpl');
     }
     self::$implementations[$algorithm] = $impl;
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:14,代码来源:MessageDigest.class.php

示例3: setAlgorithm

 /**
  * Register an algorithm
  *
  * @param   string name
  * @param   lang.XPClass<security.password.Algorithm> impl
  * @throws  lang.IllegalArgumentException in case the given class is not an Algorithm 
  */
 public static function setAlgorithm($name, XPClass $impl)
 {
     if (!$impl->isSubclassOf('security.password.Algorithm')) {
         throw new IllegalArgumentException('Given argument is not an Algorithm class (' . xp::stringOf($impl) . ')');
     }
     self::$algorithms[$name] = $impl;
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:14,代码来源:PasswordStrength.class.php

示例4: testCasesInClass

 /**
  * Get all test cases
  *
  * @param   lang.XPClass class
  * @param   var[] arguments
  * @return  unittest.TestCase[]
  */
 public function testCasesInClass(XPClass $class, $arguments = NULL)
 {
     // Verify we were actually given a testcase class
     if (!$class->isSubclassOf('unittest.TestCase')) {
         throw new IllegalArgumentException('Given argument is not a TestCase class (' . xp::stringOf($class) . ')');
     }
     // Add all tests cases
     $r = array();
     foreach ($class->getMethods() as $m) {
         $m->hasAnnotation('test') && ($r[] = $class->getConstructor()->newInstance(array_merge((array) $m->getName(TRUE), (array) $arguments)));
     }
     // Verify we actually added tests by doing this.
     if (empty($r)) {
         throw new NoSuchElementException('No tests found in ' . $class->getName());
     }
     return $r;
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:24,代码来源:AbstractSource.class.php

示例5: register

 /**
  * Register a driver
  *
  * Usage:
  * <code>
  *   DriverManager::register('mydb', XPClass::forName('my.db.Connection'));
  *   // [...]
  *   $conn= DriverManager::getConnection('mydb://...');
  * </code>
  *
  * @param   string name identifier
  * @param   lang.XPClass<rdbms.DBConnection> class
  * @throws  lang.IllegalArgumentException in case an incorrect class is given
  */
 public static function register($name, XPClass $class)
 {
     if (!$class->isSubclassOf('rdbms.DBConnection')) {
         throw new IllegalArgumentException(sprintf('Given argument must be lang.XPClass<rdbms.DBConnection>, %s given', $class->toString()));
     }
     self::$instance->drivers[$name] = $class;
     self::$instance->lookup = array();
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:22,代码来源:DriverManager.class.php

示例6: valuesOf

 /**
  * Returns the enumeration members for a given class
  *
  * @param  lang.XPClass class class object
  * @return self[]
  * @throws lang.IllegalArgumentException in case the given class is not an enum
  */
 public static function valuesOf(XPClass $class)
 {
     if (!$class->isEnum()) {
         throw new IllegalArgumentException('Argument class must be lang.XPClass<? extends lang.Enum>');
     }
     $r = [];
     if ($class->isSubclassOf(self::class)) {
         foreach ($class->reflect()->getStaticProperties() as $prop) {
             $class->isInstance($prop) && ($r[] = $prop);
         }
     } else {
         $t = ClassLoader::defineClass($class->getName() . 'Enum', self::class, []);
         foreach ($class->reflect()->getMethod('getValues')->invoke(null) as $name => $ordinal) {
             $r[] = $t->newInstance($ordinal, $name);
         }
     }
     return $r;
 }
开发者ID:xp-framework,项目名称:core,代码行数:25,代码来源:Enum.class.php


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