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

PHP XPClass类代码示例

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

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



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

示例1: 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


示例2: 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


示例3: qnameFor

 /**
  * Fetch a qname for a class.
  *
  * @param   lang.XPClass class
  * @return  var xml.QName or NULL if no mapping exists
  */
 public function qnameFor(XPClass $class)
 {
     if (!isset($this->_c2q[$class->getName()])) {
         return NULL;
     }
     return $this->_qnames[$this->_c2q[$class->getName()]];
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:13,代码来源:XPSoapMapping.class.php


示例4: 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


示例5: main

 /**
  * Main
  *
  * @param  string[] $args
  * @return int
  */
 public static function main(array $args)
 {
     $command = null;
     if (empty($args)) {
         $class = new XPClass(self::class);
         $source = $class->getClassLoader();
         $markdown = $class->getComment();
     } else {
         if ('@' === $args[0][0]) {
             $resource = substr($args[0], 1);
             if (null === ($source = ClassLoader::getDefault()->findResource($resource))) {
                 Console::$err->writeLine('No help topic named ', $resource);
                 return 2;
             }
             $markdown = $source->getResource($resource);
         } else {
             $class = $args[0];
             if (null === ($source = ClassLoader::getDefault()->findClass($class))) {
                 Console::$err->writeLine('No class named ', $class);
                 return 2;
             }
             $markdown = $source->loadClass($class)->getComment();
         }
     }
     self::render(Console::$out, $markdown, $source);
     return 1;
 }
开发者ID:xp-framework,项目名称:core,代码行数:33,代码来源:Help.class.php


示例6: uriFor

 /**
  * Tries to get class uri via reflection
  *
  * @param lang.XPClass class The class to return the URI for
  * @return string
  */
 private function uriFor(XPClass $class)
 {
     try {
         $Urimethod = $class->getClassLoader()->getClass()->getMethod('classURI');
         $Urimethod->setAccessible(TRUE);
         return $Urimethod->invoke($class->getClassLoader(), $class->getName());
     } catch (Exception $ignored) {
         return $class->getClassName();
     }
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:16,代码来源:XmlTestListener.class.php


示例7: valuesOf

 /**
  * Returns the enumeration members for a given class
  *
  * @param   lang.XPClass class class object
  * @return  lang.Enum[]
  * @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 = [];
     foreach ($class->reflect()->getStaticProperties() as $prop) {
         $class->isInstance($prop) && ($r[] = $prop);
     }
     return $r;
 }
开发者ID:johannes85,项目名称:core,代码行数:18,代码来源:Enum.class.php


示例8: methodsAnnotatedWith

 public static function methodsAnnotatedWith(XPClass $self, $annotation)
 {
     $name = substr($annotation, 1);
     $r = array();
     foreach ($self->getMethods() as $method) {
         if ($method->hasAnnotation($name)) {
             $r[] = $method;
         }
     }
     return $r;
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:11,代码来源:LocalExtensionMethodTest.class.php


示例9: forClass

 /**
  * Get instance for class
  *
  * @param   lang.XPClass class
  * @return  remote.server.BeanContainer
  */
 public static function forClass(XPClass $class)
 {
     $bc = new self();
     $bc->instancePool = new Vector();
     $bc->poolClass = $class;
     // Fetch class' classloader to check for resources configured
     // for the bean.
     $cl = $class->getClassLoader();
     // Try loading the well known resources, and remember if it exists
     $bc->configuration['log.ini'] = $cl->providesResource('etc/log.ini');
     $bc->configuration['database.ini'] = $cl->providesResource('etc/log.ini');
     $bc->configuration['cl'] = $cl;
     return $bc;
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:20,代码来源:StatelessSessionBeanContainer.class.php


示例10: compile

 /**
  * Compile and then run sourcecode
  *
  * @param   string source
  * @return  lang.Runnable
  */
 protected function compile($source)
 {
     $decl = '
 import integrationtests.ArrayExtensions;
 
 class FixturePrimitiveExtensionMethodsIntegrationTest·%d implements Runnable {
   public var run() {
     %s
   }
 }';
     $emitter = new V54Emitter();
     $task = new CompilationTask(new StringSource(sprintf($decl, $this->counter++, $source), self::$syntax, $this->name), new NullDiagnosticListener(), newinstance(FileManager::class, [$this->getClass()->getClassLoader()], '{
     protected $cl;
     
     public function __construct($cl) {
       $this->cl= $cl;
     }
     
     public function findClass($qualified) {
       return new FileSource($this->cl->getResourceAsStream("net/xp_lang/tests/integration/src/".strtr($qualified, ".", "/").".xp"));
     }
     
     public function write($r, File $target) {
       // DEBUG $r->writeTo(Console::$out->getStream());
       $r->executeWith(array());   // Defines the class
     }
   }'), $emitter);
     $type = $task->run();
     return XPClass::forName($type->name())->newInstance();
 }
开发者ID:xp-lang,项目名称:compiler,代码行数:36,代码来源:PrimitiveExtensionMethodsIntegrationTest.class.php


示例11: __construct

 /**
  * Constructor
  *
  * @param   string endpoint default 'http://api.google.com/search/beta2'
  */
 public function __construct($endpoint = 'http://api.google.com/search/beta2')
 {
     $this->client = SoapDriver::getInstance()->forEndpoint($endpoint, 'urn:GoogleSearch');
     $this->client->registerMapping(new QName('urn:GoogleSearch', 'GoogleSearchResult'), XPClass::forName('com.google.soap.search.GoogleSearchResult'));
     $this->client->registerMapping(new QName('urn:GoogleSearch', 'ResultElement'), XPClass::forName('com.google.soap.search.ResultElement'));
     $this->client->registerMapping(new QName('urn:GoogleSearch', 'DirectoryCategory'), XPClass::forName('com.google.soap.search.DirectoryCategory'));
 }
开发者ID:Gamepay,项目名称:xp-contrib,代码行数:12,代码来源:GoogleSearchClient.class.php


示例12: main

 /**
  * Main
  *
  * Exitcodes used:
  * <ul>
  *   <li>127: Archive referenced in -xar [...] does not exist</li>
  *   <li>126: No manifest or manifest does not have a main-class</li>
  * </ul>
  *
  * @see     http://tldp.org/LDP/abs/html/exitcodes.html
  * @param   string[] args
  * @return  int
  */
 public static function main(array $args)
 {
     // Open archive
     $f = new File(array_shift($args));
     if (!$f->exists()) {
         Console::$err->writeLine('*** Cannot find archive ' . $f->getURI());
         return 127;
     }
     // Register class loader
     $cl = ClassLoader::registerLoader(new ArchiveClassLoader(new Archive($f)));
     if (!$cl->providesResource(self::MANIFEST)) {
         Console::$err->writeLine('*** Archive ' . $f->getURI() . ' does not have a manifest');
         return 126;
     }
     // Load manifest
     $pr = Properties::fromString($cl->getResource(self::MANIFEST));
     if (NULL === ($class = $pr->readString('archive', 'main-class', NULL))) {
         Console::$err->writeLine('*** Archive ' . $f->getURI() . '\'s manifest does not have a main class');
         return 126;
     }
     // Run main()
     try {
         return XPClass::forName($class, $cl)->getMethod('main')->invoke(NULL, array($args));
     } catch (TargetInvocationException $e) {
         throw $e->getCause();
     }
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:40,代码来源:Xar.class.php


示例13: addPortlet

 /**
  * Add Portlets
  *
  * @param   string classname
  * @param   string layout
  * @return  xml.portlet.Portlet
  */
 public function addPortlet($classname, $layout = NULL)
 {
     with($portlet = XPClass::forName($classname)->newInstance());
     $portlet->setLayout($layout);
     $this->portlets[] = $portlet;
     return $portlet;
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:14,代码来源:PortletContainer.class.php


示例14: genericInterface

 public function genericInterface()
 {
     $interfaces = XPClass::forName('lang.Object')->getInterfaces();
     $this->assertEquals(1, sizeof($interfaces));
     $this->assertInstanceOf('lang.XPClass', $interfaces[0]);
     $this->assertEquals('lang.Generic', $interfaces[0]->getName());
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:7,代码来源:ObjectTest.class.php


示例15: forName

 /**
  * Get a type instance for a given name
  *
  * @param   string name
  * @return  lang.ArrayType
  * @throws  lang.IllegalArgumentException if the given name does not correspond to a wildcard type
  */
 public static function forName($name)
 {
     if (false === strpos($name, '?') || false === ($p = strpos($name, '<'))) {
         throw new IllegalArgumentException('Not a wildcard type: ' . $name);
     }
     $base = substr($name, 0, $p);
     $components = [];
     for ($args = substr($name, $p + 1, -1) . ',', $o = 0, $brackets = 0, $i = 0, $s = strlen($args); $i < $s; $i++) {
         if (',' === $args[$i] && 0 === $brackets) {
             $component = ltrim(substr($args, $o, $i - $o));
             if ('?' === $component) {
                 $components[] = Wildcard::$ANY;
             } else {
                 if (false === strpos($component, '?')) {
                     $components[] = parent::forName($component);
                 } else {
                     $components[] = self::forName($component);
                 }
             }
             $o = $i + 1;
         } else {
             if ('<' === $args[$i]) {
                 $brackets++;
             } else {
                 if ('>' === $args[$i]) {
                     $brackets--;
                 }
             }
         }
     }
     return new self(XPClass::forName($base), $components);
 }
开发者ID:johannes85,项目名称:core,代码行数:39,代码来源:WildcardType.class.php


示例16: matches

 /**
  * Matches implementation
  * 
  * @param   var value
  * @return  bool
  */
 public function matches($value)
 {
     if (NULL === $value && $this->matchNull) {
         return TRUE;
     }
     return xp::typeof($value) == XPClass::forName($this->type)->getName();
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:13,代码来源:TypeMatcher.class.php


示例17: __construct

 /**
  * Constructor
  *
  * @param   rdbms.DSN dsn
  */
 public function __construct($dsn)
 {
     $this->dsn = $dsn;
     $this->flags = $dsn->getFlags();
     $this->setTimeout($dsn->getProperty('timeout', 0));
     // 0 means no timeout
     // Keep this for BC reasons
     $observers = $dsn->getProperty('observer', array());
     if (NULL !== ($cat = $dsn->getProperty('log'))) {
         $observers['util.log.LogObserver'] = $cat;
     }
     // Add observers
     foreach ($observers as $observer => $param) {
         $class = XPClass::forName($observer);
         // Check if class implements BoundLogObserver: in that case use factory method to acquire instance
         if (XPClass::forName('util.log.BoundLogObserver')->isAssignableFrom($class)) {
             $this->addObserver($class->getMethod('instanceFor')->invoke(NULL, array($param)));
             // Otherwise, just use the constructor
         } else {
             $this->addObserver($class->newInstance($param));
         }
     }
     // Time zone handling
     if ($tz = $dsn->getProperty('timezone', FALSE)) {
         $this->tz = new TimeZone($tz);
     }
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:32,代码来源:DBConnection.class.php


示例18: forName

 /**
  * Returns the implementation for the given operating system.
  *
  * @param   string os operating system name, e.g. PHP_OS
  * @param   string socket default NULL
  * @return  rdbms.mysqlx.LocalSocket
  */
 public static function forName($os, $socket = NULL)
 {
     if (0 === strncasecmp($os, 'Win', 3)) {
         return XPClass::forName('rdbms.mysqlx.NamedPipe')->newInstance($socket);
     } else {
         return XPClass::forName('rdbms.mysqlx.UnixSocket')->newInstance($socket);
     }
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:15,代码来源:LocalSocket.class.php


示例19: 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


示例20: __static

 static function __static()
 {
     self::$handlers[REMOTE_MSG_INIT] = XPClass::forName('remote.server.message.EascInitMessage');
     self::$handlers[REMOTE_MSG_LOOKUP] = XPClass::forName('remote.server.message.EascLookupMessage');
     self::$handlers[REMOTE_MSG_CALL] = XPClass::forName('remote.server.message.EascCallMessage');
     self::$handlers[REMOTE_MSG_VALUE] = XPClass::forName('remote.server.message.EascValueMessage');
     self::$handlers[REMOTE_MSG_EXCEPTION] = XPClass::forName('remote.server.message.EascExceptionMessage');
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:8,代码来源:EascMessageFactory.class.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP XSDSimpleType类代码示例发布时间:2022-05-23
下一篇:
PHP XMLlist类代码示例发布时间: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