Пример #1
0
 /**
  * Gets extension info.
  *
  * @return \Wingu\OctopusCore\Reflection\ReflectionExtension
  */
 public function getExtension()
 {
     $extensionName = parent::getExtensionName();
     if ($extensionName !== false) {
         return new ReflectionExtension($extensionName);
     } else {
         return null;
     }
 }
Пример #2
0
 /**
  * Add a method to the WSDL.
  *
  * @param \Wingu\OctopusCore\Reflection\ReflectionMethod $method The reflection of the method to add.
  * @param DOMElement $port The portType element.
  * @param DOMElement $binding The binding element.
  */
 protected function addMethodToWsdl(\Wingu\OctopusCore\Reflection\ReflectionMethod $method, DOMElement $port, DOMElement $binding)
 {
     $qNameMethodName = WSDL::typeToQName($method->getName());
     $args = array();
     $annotations = array();
     $methodAnnotationsCollection = $method->getReflectionDocComment()->getAnnotationsCollection();
     if ($methodAnnotationsCollection->hasAnnotationTag('param')) {
         foreach ($methodAnnotationsCollection->getAnnotation('param') as $param) {
             $annotations[$param->getParamName()] = $param;
         }
     }
     if ($this->bindingStyle['style'] === 'document') {
         $sequence = array();
         foreach ($method->getParameters() as $param) {
             $type = 'anytype';
             if (isset($annotations['$' . $param->getName()])) {
                 $type = $annotations['$' . $param->getName()]->getParamType();
             }
             $sequenceElement = array('name' => $param->getName(), 'type' => $this->wsdl->getXSDType($type));
             if ($param->isOptional()) {
                 $sequenceElement['nillable'] = 'true';
             }
             $sequence[] = $sequenceElement;
         }
         $element = array('name' => $qNameMethodName, 'sequence' => $sequence);
         $args['parameters'] = array('element' => $this->wsdl->addElement($element));
     } else {
         foreach ($method->getParameters() as $param) {
             $type = 'anytype';
             if (isset($annotations['$' . $param->getName()])) {
                 $type = $annotations['$' . $param->getName()]->getParamType();
             }
             $args[$param->getName()] = array('type' => $this->wsdl->getXSDType($type));
         }
     }
     $this->wsdl->addMessage($qNameMethodName . 'In', $args);
     $returnType = null;
     if ($methodAnnotationsCollection->hasAnnotationTag('return') === true) {
         $annotation = $methodAnnotationsCollection->getAnnotation('return');
         $annotation = reset($annotation);
         $returnType = $annotation->getReturnType();
     }
     $isOneWayMessage = $returnType === null;
     if ($isOneWayMessage === false) {
         $args = array();
         if ($this->bindingStyle['style'] === 'document') {
             $sequence = array();
             if ($returnType !== null) {
                 $sequence[] = array('name' => $qNameMethodName . 'Result', 'type' => $this->wsdl->getXSDType($returnType));
             }
             $element = array('name' => $qNameMethodName . 'Response', 'sequence' => $sequence);
             $args['parameters'] = array('element' => $this->wsdl->addElement($element));
         } elseif ($returnType !== null) {
             $args['return'] = array('type' => $this->wsdl->getXSDType($returnType));
         }
         $this->wsdl->addMessage($qNameMethodName . 'Out', $args);
     }
     // Add the portType operation.
     if ($isOneWayMessage === false) {
         $portOperation = $this->wsdl->addPortOperation($port, $qNameMethodName, 'tns:' . $qNameMethodName . 'In', 'tns:' . $qNameMethodName . 'Out');
     } else {
         $portOperation = $this->wsdl->addPortOperation($port, $qNameMethodName, 'tns:' . $qNameMethodName . 'In', false);
     }
     // Add any documentation for the operation.
     $description = $method->getReflectionDocComment()->getFullDescription();
     if (strlen($description) > 0) {
         $this->wsdl->addDocumentation($portOperation, $description);
     }
     // When using the RPC style, make sure the operation style includes a 'namespace' attribute (WS-I Basic Profile 1.1 R2717).
     if ($this->bindingStyle['style'] === 'rpc' && isset($this->operationBodyStyle['namespace']) === false) {
         $this->operationBodyStyle['namespace'] = '' . $this->uri;
     }
     // Add the binding operation.
     $operation = $this->wsdl->addBindingOperation($binding, $qNameMethodName, $this->operationBodyStyle, $this->operationBodyStyle);
     $this->wsdl->addSoapOperation($operation, $this->uri . '#' . $qNameMethodName);
 }
Пример #3
0
 public function addSubCommand($name, $instance, Reflection\ReflectionMethod $method)
 {
     //echo "+{$this->getName()} {$name} --> ".get_class($instance)."::{$method->getName()}()\n";
     $this->sub[$name] = new SubCommand($name, $instance, $method->getName());
     $this->updateDocumentation();
 }