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


PHP XPClass类代码示例

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


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


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