Permalink
Browse files

[UPDATE] minor bug fixes and enhancements

[UPDATE] fix sample file for unknown parameter types, update doc comment
for service classes, update getResult doc comment in order to have
unique return type, update doc comment for autoload file
  • Loading branch information...
mikaelcom committed Dec 6, 2012
1 parent 1d24b34 commit 325428cc7d049889ca859bcbb3305573dcc8dd67
Showing with 14 additions and 10 deletions.
  1. +2 −2 WsdlClassFileTpl.php
  2. +12 −8 WsdlToPhp.php
@@ -501,11 +501,11 @@ public function getInternArrayToIterateOffset()
* @param array $_array
* @param bool $_interCall
*/
public function initInternArrayToIterate(array $_array = array(),$_interCall = false)
public function initInternArrayToIterate($_array = array(),$_interCall = false)
{
if(strpos($this->__toString(),'ArrayOf') !== false)
{
if(count($_array))
if(is_array($_array) && count($_array))
{
$this->setInternArrayToIterate($_array);
$this->setInternArrayToIterateOffset(0);
@@ -995,6 +995,8 @@ private function generateFunctionsClasses($_packageName,$_rootDirectory,$_rootDi
}
}
}
else
$methodsToCall[] = ($this->getOptionSendArrayAsParameter()?'\'' . $methodInfos['parameter'] . '\'=>':'') . '$_' . lcfirst($cleanParameterName);
/**
* Return name
*/
@@ -1046,7 +1048,8 @@ private function generateFunctionsClasses($_packageName,$_rootDirectory,$_rootDi
/**
* Result method
*/
$php->appendCustomCode("/**\r\n * Method returning the result content\r\n *\r\n * @return " . implode('|',$methodReturns) . "\r\n */");
$methodReturns = array_unique($methodReturns);
$php->appendCustomCode("/**\r\n * Method returning the result content\r\n * @return " . implode('|',$methodReturns) . "\r\n */");
$php->appendCustomCode("public function getResult()");
$php->appendCustomCode("{");
$php->indentLevel++;
@@ -1056,7 +1059,7 @@ private function generateFunctionsClasses($_packageName,$_rootDirectory,$_rootDi
/**
* Class name
*/
$php->appendCustomCode("/**\r\n * Method returning the class name\r\n *\r\n * @return string __CLASS__\r\n */");
$php->appendCustomCode("/**\r\n * Method returning the class name\r\n * @return string __CLASS__\r\n */");
$php->appendCustomCode("public function __toString()");
$php->appendCustomCode("{");
$php->indentLevel++;
@@ -1123,7 +1126,7 @@ private function generateAutoloadFile($_packageName,$_rootDirectory,$_rootDirect
if(count($_classesFiles))
{
$php = new ezcPhpGenerator($_rootDirectory . '/' . ucfirst($_packageName) . 'Autoload.php',true,true);
$php->appendCustomCode("/**\r\n * AutoloadFile \r\n * @date " . date('d/m/Y') . "\r\n */\r\n/**\r\n * AutoloadFile\r\n * @date " . date('d/m/Y') . "\r\n */");
$php->appendCustomCode("/**\r\n * Autoload File \r\n * @date " . date('d/m/Y') . "\r\n */\r\n/**\r\n * Includes for all generated classes files\r\n * @date " . date('d/m/Y') . "\r\n */");
foreach($_classesFiles as $classFile)
{
if(is_file($classFile))
@@ -1206,19 +1209,20 @@ private function generateTutorialFile($_packageName,$_rootDirectory,$_rootDirect
}
if(count($classMethods))
{
$classNameVar = lcfirst($className);
$content .= "\r\n\r\n/**" . str_repeat('*',strlen("Example for $className")) . "\r\n * Example for $className\r\n */";
$content .= "\r\n\$$className = new $className(\$wsdl);";
$content .= "\r\n\$$classNameVar = new $className(\$wsdl);";
foreach($classMethods as $classMethod)
{
$content .= "\r\n// sample call for $className::" . $classMethod->getName() . '()';
$classParameters = $classMethod->getParameters();
$parameters = array();
foreach($classParameters as $classParameter)
array_push($parameters,'new ' . ucfirst(substr($classParameter->getName(),1)) . '(/*** update parameters list ***/)');
$content .= "\r\nif(\$$className->" . $classMethod->getName() . '(' . implode(',',$parameters) . '))';
$content .= "\r\n\t" . 'print_r($' . $className . '->getResult());';
array_push($parameters,class_exists(ucfirst(substr($classParameter->getName(),1)))?'new ' . ucfirst(substr($classParameter->getName(),1)) . '(/*** update parameters list ***/)':'$' . lcfirst($classParameter->getName()));
$content .= "\r\nif(\$$classNameVar->" . $classMethod->getName() . '(' . implode(',',$parameters) . '))';
$content .= "\r\n\t" . 'print_r($' . $classNameVar . '->getResult());';
$content .= "\r\nelse";
$content .= "\r\n\tprint_r($" . $className . "->getLastError());";
$content .= "\r\n\tprint_r($" . $classNameVar . "->getLastError());";
}
}
}

0 comments on commit 325428c

Please sign in to comment.