Skip to content
This repository has been archived by the owner on Jun 19, 2019. It is now read-only.

Commit

Permalink
[UPDATE] minor bug fixes and enhancements
Browse files Browse the repository at this point in the history
[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
DELSOL Mikaël committed Dec 6, 2012
1 parent 1d24b34 commit 325428c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions WsdlClassFileTpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
20 changes: 12 additions & 8 deletions WsdlToPhp.php
Original file line number Diff line number Diff line change
Expand Up @@ -995,6 +995,8 @@ private function generateFunctionsClasses($_packageName,$_rootDirectory,$_rootDi
}
}
}
else
$methodsToCall[] = ($this->getOptionSendArrayAsParameter()?'\'' . $methodInfos['parameter'] . '\'=>':'') . '$_' . lcfirst($cleanParameterName);
/**
* Return name
*/
Expand Down Expand Up @@ -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++;
Expand All @@ -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++;
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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());";
}
}
}
Expand Down

0 comments on commit 325428c

Please sign in to comment.