/**
  * Test data type details for the same type name set multiple times.
  */
 public function testSetTypeDataArrayMerge()
 {
     $this->_typeProcessor->setTypeData('typeA', ['dataA1']);
     $this->_typeProcessor->setTypeData('typeA', ['dataA2']);
     $this->_typeProcessor->setTypeData('typeA', ['dataA3']);
     $this->_typeProcessor->setTypeData('typeA', [null]);
     $this->assertEquals(['dataA1', 'dataA2', 'dataA3', null], $this->_typeProcessor->getTypeData('typeA'));
 }
 /**
  * Process array of types.
  *
  * @param string $type
  * @param array $callInfo
  * @return void
  */
 protected function _processArrayParameter($type, $callInfo = [])
 {
     $arrayItemType = $this->_typeProcessor->getArrayItemType($type);
     $arrayTypeName = $this->_typeProcessor->translateArrayTypeName($type);
     if (!$this->_typeProcessor->isTypeSimple($arrayItemType) && !$this->_typeProcessor->isTypeAny($arrayItemType)) {
         $this->addComplexType($arrayItemType, $callInfo);
     }
     $arrayTypeParameters = [self::ARRAY_ITEM_KEY_NAME => ['type' => $arrayItemType, 'required' => false, 'isArray' => true, 'documentation' => sprintf('An item of %s.', $arrayTypeName)]];
     $arrayTypeData = ['documentation' => sprintf('An array of %s items.', $arrayItemType), 'parameters' => $arrayTypeParameters];
     $this->_typeProcessor->setTypeData($arrayTypeName, $arrayTypeData);
     $this->addComplexType($arrayTypeName, $callInfo);
 }
Esempio n. 3
0
 /**
  * Add WSDL elements related to generic SOAP fault, which are common for all operations: element, type and message.
  *
  * @param Wsdl $wsdl
  * @return string Default fault message name
  */
 protected function _addGenericFaultComplexTypeNodes($wsdl)
 {
     $faultMessageName = Fault::NODE_DETAIL_WRAPPER;
     $complexTypeName = $this->getElementComplexTypeName($faultMessageName);
     $wsdl->addElement(['name' => $faultMessageName, 'type' => Wsdl::TYPES_NS . ':' . $complexTypeName]);
     $faultParamsComplexType = Fault::NODE_DETAIL_PARAMETER;
     $faultParamsData = ['parameters' => [Fault::NODE_DETAIL_PARAMETER_KEY => ['type' => 'string', 'required' => true, 'documentation' => ''], Fault::NODE_DETAIL_PARAMETER_VALUE => ['type' => 'string', 'required' => true, 'documentation' => '']]];
     $wrappedErrorComplexType = Fault::NODE_DETAIL_WRAPPED_ERROR;
     $wrappedErrorData = ['parameters' => [Fault::NODE_DETAIL_WRAPPED_ERROR_MESSAGE => ['type' => 'string', 'required' => true, 'documentation' => ''], Fault::NODE_DETAIL_WRAPPED_ERROR_PARAMETERS => ['type' => "{$faultParamsComplexType}[]", 'required' => false, 'documentation' => 'Message parameters.']]];
     $genericFaultTypeData = ['parameters' => [Fault::NODE_DETAIL_TRACE => ['type' => 'string', 'required' => false, 'documentation' => 'Exception calls stack trace.'], Fault::NODE_DETAIL_PARAMETERS => ['type' => "{$faultParamsComplexType}[]", 'required' => false, 'documentation' => 'Additional exception parameters.'], Fault::NODE_DETAIL_WRAPPED_ERRORS => ['type' => "{$wrappedErrorComplexType}[]", 'required' => false, 'documentation' => 'Additional wrapped errors.']]];
     $this->_typeProcessor->setTypeData($faultParamsComplexType, $faultParamsData);
     $this->_typeProcessor->setTypeData($wrappedErrorComplexType, $wrappedErrorData);
     $this->_typeProcessor->setTypeData($complexTypeName, $genericFaultTypeData);
     $wsdl->addComplexType($complexTypeName);
     $wsdl->addMessage($faultMessageName, ['messageParameters' => ['element' => Wsdl::TYPES_NS . ':' . $faultMessageName]]);
     return Wsdl::TYPES_NS . ':' . $faultMessageName;
 }