/** * Test data type details for the same type name set multiple times. */ public function testSetTypeDataArrayMerge() { $this->_typeProcessor->setTypeData('typeA', array('dataA1')); $this->_typeProcessor->setTypeData('typeA', array('dataA2')); $this->_typeProcessor->setTypeData('typeA', array('dataA3')); $this->assertEquals(array('dataA1', 'dataA2', 'dataA3'), $this->_typeProcessor->getTypeData('typeA')); }
/** * Process array of types. * * @param string $type * @param array $callInfo * @return void */ protected function _processArrayParameter($type, $callInfo = array()) { $arrayItemType = $this->_typeProcessor->getArrayItemType($type); $arrayTypeName = $this->_typeProcessor->translateArrayTypeName($type); if (!$this->_typeProcessor->isTypeSimple($arrayItemType)) { $this->addComplexType($arrayItemType, $callInfo); } $arrayTypeParameters = array(self::ARRAY_ITEM_KEY_NAME => array('type' => $arrayItemType, 'required' => false, 'isArray' => true, 'documentation' => sprintf('An item of %s.', $arrayTypeName))); $arrayTypeData = array('documentation' => sprintf('An array of %s items.', $arrayItemType), 'parameters' => $arrayTypeParameters); $this->_typeProcessor->setTypeData($arrayTypeName, $arrayTypeData); $this->addComplexType($arrayTypeName, $callInfo); }
/** * 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(array('name' => $faultMessageName, 'type' => Wsdl::TYPES_NS . ':' . $complexTypeName)); $faultParamsComplexType = Fault::NODE_DETAIL_PARAMETER; $faultParamsData = array('parameters' => array(Fault::NODE_DETAIL_PARAMETER_KEY => array('type' => 'string', 'required' => true, 'documentation' => ''), Fault::NODE_DETAIL_PARAMETER_VALUE => array('type' => 'string', 'required' => true, 'documentation' => ''))); $wrappedErrorComplexType = Fault::NODE_DETAIL_WRAPPED_ERROR; $wrappedErrorData = array('parameters' => array(Fault::NODE_DETAIL_WRAPPED_ERROR_MESSAGE => array('type' => 'string', 'required' => true, 'documentation' => ''), Fault::NODE_DETAIL_WRAPPED_ERROR_PARAMETERS => array('type' => "{$faultParamsComplexType}[]", 'required' => false, 'documentation' => 'Message parameters.'))); $genericFaultTypeData = array('parameters' => array(Fault::NODE_DETAIL_TRACE => array('type' => 'string', 'required' => false, 'documentation' => 'Exception calls stack trace.'), Fault::NODE_DETAIL_PARAMETERS => array('type' => "{$faultParamsComplexType}[]", 'required' => false, 'documentation' => 'Additional exception parameters.'), Fault::NODE_DETAIL_WRAPPED_ERRORS => array('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, array('messageParameters' => array('element' => Wsdl::TYPES_NS . ':' . $faultMessageName))); return Wsdl::TYPES_NS . ':' . $faultMessageName; }