/**
  * Creates a new operation with from a given annotated php method.
  *
  * @param ReflectionAnnotatedMethod $method An annotated php method
  *
  * @return ckWsdlOperation An operation, which's input corresponds to the parameters and which's output
  *                         corresponds to the return value of the given php method.
  */
 public static function create(ReflectionAnnotatedMethod $method)
 {
     $name = $method->getAnnotation('WSMethod')->getName();
     $result = new ckWsdlOperation();
     $result->setName($name);
     $params = ckDocBlockParser::parseParameters($method->getDocComment());
     $return = ckDocBlockParser::parseReturn($method->getDocComment());
     $headers = $method->getAllAnnotations('WSHeader');
     $result->input = new ckWsdlMessage($name . 'Request');
     $result->output = new ckWsdlMessage($name . 'Response');
     foreach ($headers as $header) {
         $type = ckXsdType::get($header->type);
         $type->setName($header->name);
         ckXsdType::set($header->name, $type);
         ckXsdType::set($header->type, null);
         $result->input->addPart(new ckWsdlPart($header->name, $type, true));
         $result->output->addPart(new ckWsdlPart($header->name, $type, true));
     }
     foreach ($params as $param) {
         $type = ckXsdType::get($param['type']);
         $result->input->addPart(new ckWsdlPart($param['name'], $type));
     }
     if (!empty($return)) {
         $type = ckXsdType::get($return['type']);
         $result->output->addPart(new ckWsdlPart('result', $type));
     }
     return $result;
 }
 /**
  * Creates a new array type object, if the given type name is one of an array type.
  *
  * @param string $name The name of an array type
  *
  * @return ckXsdArrayType The array type object
  */
 public static function create($name)
 {
     if (self::isArrayType($name)) {
         $elementTypeName = substr($name, 0, -strlen(self::ARRAY_SUFFIX));
         $elementType = ckXsdType::get($elementTypeName);
         if (!is_null($elementType)) {
             return new ckXsdArrayType(ckString::ucfirst($elementType->getName()) . self::NAME_SUFFIX, ckXsdNamespace::get('tns'), $elementType);
         }
     }
     return null;
 }
 /**
  * Gets all complex and array types.
  *
  * @return array An array containing all complex and array types
  */
 public function getTypes()
 {
     return ckXsdType::getComplexAndArrayTypes();
 }
Exemplo n.º 4
0
 /**
  * Gets all registered complex and array types.
  *
  * @return array An array containing all registered complex and array types
  */
 public static function getComplexAndArrayTypes()
 {
     return array_filter(ckXsdType::getAll(), array(__CLASS__, 'isComplexOrArrayType'));
 }
 /**
  * Protected constructor initializing the simple xsd type with a given name.
  *
  * @param string $name The name of the simple xsd type
  */
 protected function __construct($name = null)
 {
     parent::__construct($name, ckXsdNamespace::get('xsd'));
 }
 protected function __construct($name = null, ckXsdNamespace $namespace = null)
 {
     parent::__construct($name, $namespace);
 }
 protected function __construct($name = null, ckXsdNamespace $namespace = null, ckXsdType $elementType = null)
 {
     parent::__construct($name, $namespace);
     $this->setElementType($elementType);
 }