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


PHP Reflection::reflectClass方法代码示例

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


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

示例1: introspect

 /**
  * Create XML definition on an AMF service class
  *
  * @param  string $serviceClass Service class name
  * @param  array $options invocation options
  * @return string XML with service class introspection
  */
 public function introspect($serviceClass, $options = array())
 {
     $this->_options = $options;
     if (strpbrk($serviceClass, '\\/<>')) {
         return $this->_returnError('Invalid service name');
     }
     // Transform com.foo.Bar into com\foo\Bar
     $serviceClass = str_replace('.', '\\', $serviceClass);
     // Introspect!
     if (!class_exists($serviceClass)) {
         if (!$this->_loadClass($serviceClass)) {
             return $this->_returnError('Invalid service name; class does not exist');
         }
     }
     $serv = $this->_xml->createElement('service-description');
     $serv->setAttribute('xmlns', 'http://ns.adobe.com/flex/service-description/2008');
     $this->_types = $this->_xml->createElement('types');
     $this->_ops = $this->_xml->createElement('operations');
     $r = Reflection::reflectClass($serviceClass);
     $this->_addService($r, $this->_ops);
     $serv->appendChild($this->_types);
     $serv->appendChild($this->_ops);
     $this->_xml->appendChild($serv);
     return $this->_xml->saveXML();
 }
开发者ID:bojaspus,项目名称:zendamf,代码行数:32,代码来源:Introspector.php

示例2: loadClassInfo

 protected function loadClassInfo()
 {
     $class_info = Reflection::reflectClass($this);
     $this->namespace = $class_info->getNamespaceName();
     $dir = dirname($class_info->getFileName());
     if (strstr($dir, "src/{$this->namespace}")) {
         $dir = dirname(dirname($dir));
     }
     $this->dir = $dir;
 }
开发者ID:spacedgap,项目名称:sgap-php-custom-library,代码行数:10,代码来源:AbstractZf2Module.php

示例3: setClass

 /**
  * Set the Class the SOAP server will use
  *
  * @param string $class Class Name
  * @param string $namespace Class Namspace - Not Used
  * @param array $argv Arguments to instantiate the class - Not Used
  */
 public function setClass($class, $namespace = '', $argv = null)
 {
     $uri = $this->getUri();
     $translatedClassName = Wsdl::translateType($class);
     $wsdl = new $this->_wsdlClass($translatedClassName, $uri, $this->_strategy);
     // The wsdl:types element must precede all other elements (WS-I Basic Profile 1.1 R2023)
     $wsdl->addSchemaTypeSection();
     $port = $wsdl->addPortType($translatedClassName . 'Port');
     $binding = $wsdl->addBinding($translatedClassName . 'Binding', 'tns:' . $translatedClassName . 'Port');
     $wsdl->addSoapBinding($binding, $this->_bindingStyle['style'], $this->_bindingStyle['transport']);
     $wsdl->addService($translatedClassName . 'Service', $translatedClassName . 'Port', 'tns:' . $translatedClassName . 'Binding', $uri);
     foreach ($this->_reflection->reflectClass($class)->getMethods() as $method) {
         $this->_addFunctionToWsdl($method, $wsdl, $port, $binding);
     }
     $this->_wsdl = $wsdl;
 }
开发者ID:navtis,项目名称:xerxes-pazpar2,代码行数:23,代码来源:AutoDiscover.php

示例4: setClass

 /**
  * Register a class with the server
  *
  * @param  string $class
  * @param  string $namespace Ignored
  * @param  mixed $argv Ignored
  * @return Server
  */
 public function setClass($class, $namespace = '', $argv = null)
 {
     if (2 < func_num_args()) {
         $argv = func_get_args();
         $argv = array_slice($argv, 2);
     }
     $reflection = Reflection::reflectClass($class, $argv, $namespace);
     foreach ($reflection->getMethods() as $method) {
         $definition = $this->_buildSignature($method, $class);
         $this->_addMethodServiceMap($definition);
     }
     return $this;
 }
开发者ID:bradley-holt,项目名称:zf2,代码行数:21,代码来源:Server.php

示例5: setClass

 /**
  * Attach class methods as XMLRPC method handlers
  *
  * $class may be either a class name or an object. Reflection is done on the
  * class or object to determine the available public methods, and each is
  * attached to the server as an available method; if a $namespace has been
  * provided, that namespace is used to prefix the XMLRPC method names.
  *
  * Any additional arguments beyond $namespace will be passed to a method at
  * invocation.
  *
  * @param string|object $class
  * @param string $namespace Optional
  * @param mixed $argv Optional arguments to pass to methods
  * @return void
  * @throws Server\Exception\InvalidArgumentException on invalid input
  */
 public function setClass($class, $namespace = '', $argv = null)
 {
     if (is_string($class) && !class_exists($class)) {
         throw new Server\Exception\InvalidArgumentException('Invalid method class', 610);
     }
     if (2 < func_num_args()) {
         $argv = func_get_args();
         $argv = array_slice($argv, 2);
     }
     $dispatchable = Reflection::reflectClass($class, $argv, $namespace);
     foreach ($dispatchable->getMethods() as $reflection) {
         $this->_buildSignature($reflection, $class);
     }
 }
开发者ID:haoyanfei,项目名称:zf2,代码行数:31,代码来源:Server.php

示例6: _generateClass

 /**
  * Generate the WSDL for a service class.
  *
  * @return Zend\Soap\Wsdl
  */
 protected function _generateClass()
 {
     return $this->_generateWsdl($this->_reflection->reflectClass($this->_class)->getMethods());
 }
开发者ID:bradley-holt,项目名称:zf2,代码行数:9,代码来源:AutoDiscover.php

示例7: testReflectClass2

 /**
  * reflectClass() test; test namespaces
  */
 public function testReflectClass2()
 {
     $reflection = Reflection::reflectClass('ZendTest\\Server\\ReflectionTestClass', false, 'zsr');
     $this->assertEquals('zsr', $reflection->getNamespace());
 }
开发者ID:rexmac,项目名称:zf2,代码行数:8,代码来源:ReflectionTest.php

示例8: setClass

    /**
     * Attach a class or object to the server
     *
     * Class may be either a class name or an instantiated object. Reflection
     * is done on the class or object to determine the available public
     * methods, and each is attached to the server as and available method. If
     * a $namespace has been provided, that namespace is used to prefix
     * AMF service call.
     *
     * @param  string|object $class
     * @param  string $namespace Optional
     * @param  mixed $arg Optional arguments to pass to a method
     * @return Server
     * @throws Exception\InvalidArgumentException on invalid input
     */
    public function setClass($class, $namespace = '', $argv = null)
    {
        if (is_string($class) && !class_exists($class)){
            throw new Exception\InvalidArgumentException('Invalid method or class');
        } elseif (!is_string($class) && !is_object($class)) {
            throw new Exception\InvalidArgumentException('Invalid method or class; must be a classname or object');
        }

        $argv = null;
        if (2 < func_num_args()) {
            $argv = array_slice(func_get_args(), 2);
        }

        // Use the class name as the name space by default.

        if ($namespace == '') {
            $namespace = is_object($class) ? get_class($class) : $class;
        }

        $this->_classAllowed[is_object($class) ? get_class($class) : $class] = true;

        $this->_methods[] = Reflection::reflectClass($class, $argv, $namespace);
        $this->_buildDispatchTable();

        return $this;
    }
开发者ID:necrogami,项目名称:zf2,代码行数:41,代码来源:Server.php

示例9: setClass

 /**
  * (non-PHPdoc).
  *
  * @see \Zend\Json\Server\Server::setClass()
  */
 public function setClass($class, $namespace = '', $argv = null)
 {
     if (2 < func_num_args()) {
         $argv = func_get_args();
         $argv = array_slice($argv, 2);
     }
     $methods = [];
     if (is_array($class)) {
         $methods = $class['methods'];
         $class = $class['class'];
     }
     $obj = $class;
     if ($this->container->has($class)) {
         $obj = $this->container->get($class);
     }
     $reflection = Reflection::reflectClass($obj, $argv, $namespace);
     foreach ($reflection->getMethods() as $method) {
         $docComment = $method->getDocComment();
         if ($docComment !== false && (new DocBlockReflection($docComment))->hasTag('invokable') || in_array($method->getName(), $methods)) {
             $definition = $this->_buildSignature($method, $class);
             $this->addMethodServiceMap($definition);
         }
     }
     return $this;
 }
开发者ID:buse974,项目名称:jrpc,代码行数:30,代码来源:Server.php


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