@@ -174,11 +174,11 @@ class WSDLInterpreter
174174 private $ package = null ;
175175
176176 /**
177- * Whether or not to enable psuedo namespaces in the generated class names.
177+ * Whether or not to enable namespaces in the generated class names.
178178 * @var string
179179 * @access private
180180 */
181- private $ enablePseudoNamespaces = null ;
181+ private $ enableNamespaces = null ;
182182
183183 /**
184184 * The class path of the SOAP client to require in the PHP file.
@@ -241,14 +241,14 @@ class WSDLInterpreter
241241 * @param string $soapClientClassPath the class path to require for the
242242 * SOAP client
243243 * @param string $proxy the proxy URL to use when downloading WSDLs
244- * @param boolean $enablePseudoNamespaces to enable the namespaces
244+ * @param boolean $enableNamespaces to enable the namespaces
245245 * @param array $skipClassNameCheckTypes ignore class name checking list
246246 * @throws WSDLInterpreterException container for all WSDL interpretation
247247 * problems
248248 */
249249 public function __construct ($ wsdlUri , $ soapClientClassName , $ classmap ,
250250 $ conflictClassmap , $ serviceName , $ version , $ package , $ soapClientClassPath ,
251- $ proxy , $ enablePseudoNamespaces , $ skipClassNameCheckTypes )
251+ $ proxy , $ enableNamespaces , $ skipClassNameCheckTypes )
252252 {
253253 // Configure the interpreter
254254 $ this ->wsdlUri = $ wsdlUri ;
@@ -258,7 +258,7 @@ public function __construct($wsdlUri, $soapClientClassName, $classmap,
258258 $ this ->version = $ version ;
259259 $ this ->package = $ package ;
260260 $ this ->classmap = $ classmap ?: $ this ->classmap ;
261- $ this ->enablePseudoNamespaces = $ enablePseudoNamespaces ?: false ;
261+ $ this ->enableNamespaces = $ enableNamespaces ?: false ;
262262
263263 $ conflictClassmap = $ conflictClassmap ?: array ();
264264 $ this ->classmap = array_merge ($ this ->classmap , $ conflictClassmap );
@@ -292,7 +292,7 @@ public function __construct($wsdlUri, $soapClientClassName, $classmap,
292292 // Prepare wsdl utility with the loaded settings
293293 $ this ->utils ->setRenameClassMap ($ this ->classmap );
294294 $ this ->utils ->setSkipClassNameCheck ($ this ->skipClassNameCheckTypes );
295- if ($ this ->enablePseudoNamespaces ) {
295+ if ($ this ->enableNamespaces ) {
296296 $ this ->utils ->setPhpNamespace ($ this ->package );
297297 }
298298 $ this ->utils ->setWsdlNamespaceMap ($ this ->namespaceMap );
@@ -525,7 +525,7 @@ private function generateClassPHP(WsdlElement_Class $class) {
525525 $ constructor = $ this ->generateConstructorPHP ($ class );
526526
527527 return <<<EOF
528- if (!class_exists(" {$ class ->getName ()}", false)) {
528+ if (!class_exists(" {$ class ->getQuotedFqn ()}", false)) {
529529 /**
530530{$ paddedDocs }
531531 * @package {$ this ->package }
@@ -681,7 +681,7 @@ private function generateServicePHP(WsdlElement_Service $service) {
681681 * @package {$ this ->package }
682682 * @subpackage {$ this ->version }
683683 */
684- class {$ service ->getName ()} extends {$ this ->soapClientClassName } {
684+ class {$ service ->getName ()} extends {$ this ->utils -> namespaceName ( $ this -> soapClientClassName ) } {
685685
686686 const SERVICE_NAME = " {$ service ->getRawName ()}";
687687 const WSDL_NAMESPACE = " {$ this ->serviceNamespace }";
@@ -740,7 +740,7 @@ private function generateServiceClassmapPHP(WsdlElement_Service $service) {
740740EOF ;
741741 foreach ($ this ->wsdlClasses as $ wsdlClass ) {
742742 $ return .= sprintf (" \"%s \" => \"%s \", \n" , $ wsdlClass ->getRawName (),
743- $ wsdlClass ->getName ( ));
743+ addslashes ( $ wsdlClass ->getFqn () ));
744744 }
745745 $ return .= " ); \n\n" ;
746746
@@ -793,23 +793,20 @@ public function {$rawName}({$functionArgString}) {
793793 * @return array array of source code files that were written out
794794 * @throws WSDLInterpreterException problem in writing out service sources
795795 */
796- public function savePHP ($ outputDirectory )
797- {
796+ public function savePHP ($ outputDirectory ) {
798797 if (!count ($ this ->servicePHPSources )) {
799798 throw new WSDLInterpreterException ("No services loaded " );
800799 }
801- $ require = sprintf (
802- "/** Required classes. **/ \nrequire_once \"%s \"; \n\n" ,
803- $ this ->soapClientClassPath
804- );
800+ $ namespace = $ this ->enableNamespaces ? sprintf ("namespace %s; \n\n" ,
801+ $ this ->utils ->getNamespace ()) : '' ;
802+ $ require = sprintf ("require_once \"%s \"; \n\n" , $ this ->soapClientClassPath );
805803 $ classSource = join ("\n\n" , $ this ->classPHPSources );
806804 $ outputFiles = array ();
807805 foreach ($ this ->servicePHPSources as $ serviceName => $ serviceCode ) {
808806 $ filename = sprintf ('%s/%s.php ' , $ outputDirectory , $ serviceName );
809807 $ success = file_put_contents ($ filename , sprintf (
810- "<?php \n%s \n%s%s \n\n%s " ,
811- $ this ->getFileHeader (), $ require , $ classSource , $ serviceCode
812- ));
808+ "<?php \n%s%s%s%s \n\n%s \n\n" , $ this ->getFileHeader (), $ namespace ,
809+ $ require , $ classSource , $ serviceCode ));
813810 if ($ success ) {
814811 $ outputFiles [] = $ filename ;
815812 }
0 commit comments