/** * @param MethodContainer $methods * @param MethodModel $method */ protected function addSoapHeaderFromMethod(MethodContainer $methods, MethodModel $method) { $soapHeaderNames = $method->getMetaValue(TagHeader::META_SOAP_HEADER_NAMES, array()); $soapHeaderNamespaces = $method->getMetaValue(TagHeader::META_SOAP_HEADER_NAMESPACES, array()); $soapHeaderTypes = $method->getMetaValue(TagHeader::META_SOAP_HEADER_TYPES, array()); foreach ($soapHeaderNames as $index => $soapHeaderName) { $methodName = $this->getSoapHeaderMethodName($soapHeaderName); if ($methods->get($methodName) === null) { $soapHeaderNamespace = array_key_exists($index, $soapHeaderNamespaces) ? $soapHeaderNamespaces[$index] : null; $soapHeaderType = array_key_exists($index, $soapHeaderTypes) ? $soapHeaderTypes[$index] : null; $methods->add($this->getSoapHeaderMethod($methodName, $soapHeaderName, $soapHeaderNamespace, $soapHeaderType)); } } return $this; }
/** * @param string $serviceVariableName * @param MethodModel $method * @param array $added * @return string[] */ protected function addServiceSoapHeadersDefinition($serviceVariableName, MethodModel $method, array $added) { $addedNames = array(); $soapHeaderNames = $method->getMetaValue(TagHeader::META_SOAP_HEADER_NAMES, array()); foreach ($soapHeaderNames as $soapHeaderName) { if (!in_array($soapHeaderName, $added, true)) { $addedNames[] = $soapHeaderName; $this->getFile()->getMainElement()->addChild(sprintf('$%s->%s%s(%s);', $serviceVariableName, Service::METHOD_SET_HEADER_PREFIX, ucfirst($soapHeaderName), $this->getMethodParameter($soapHeaderName))); } } return $addedNames; }
/** * @param Method $method * @param string $soapHeaderName * @return bool */ protected function isSoapHeaderAlreadyDefined(Method $method, $soapHeaderName) { $methodSoapHeaders = $method->getMetaValue(self::META_SOAP_HEADER_NAMES, array()); return in_array($soapHeaderName, $methodSoapHeaders, true); }