.
*/
if(basename($_SERVER['SCRIPT_FILENAME'])==basename(__FILE__))
exit;
PhpWsdl::RegisterHook('InterpretKeywordparamHook','internal','PhpWsdlParam::InterpretParam');
PhpWsdl::RegisterHook('InterpretKeywordreturnHook','internal','PhpWsdlParam::InterpretReturn');
/**
* A parameter or return value definition for a method
*
* @author Andreas Zimmermann, wan24.de
*/
class PhpWsdlParam extends PhpWsdlObject{
/**
* The parameter type name
*
* @var string
*/
public $Type;
/**
* Documentation
*
* @var string
*/
public $Docs=null;
/**
* The default name for the return value object
* Use %method% as placeholder for the method name
*
* @var string
*/
public static $DefaultReturnName='return';
/**
* Constructor
*
* @param string $name The name
* @param string $type Optional the type name (default: string)
* @param array $settings Optional the settings hash array (default: NULL)
*/
public function PhpWsdlParam($name,$type='string',$settings=null){
self::__construct($name, $type, $settings);
}
public function __construct($name,$type='string',$settings=null){
PhpWsdl::Debug('New parameter '.$name);
parent::__construct($name,$settings);
$this->Type=$type;
}
/**
* Create the part WSDL
*
* @param PhpWsdl $pw The PhpWsdl object
* @return string The WSDL
*/
public function CreatePart($pw){
PhpWsdl::Debug('Create WSDL definition for parameter part '.$this->Name);
$res='
Return value '; $o=sizeof($res)-1; $type=$m->Return->Type; if(in_array($type,PhpWsdl::$BasicTypes)){ $res[$o].=''.$type.''; }else{ $res[$o].=''.$type.''; } $res[$o].=''.((!is_null($m->Return->Docs))?': '.nl2br(htmlentities($m->Return->Docs)):'').'
'; PhpWsdl::CallHook( 'CreateReturnHtmlHook', $data ); } /** * Interpret a parameter keyword * * @param array $data The parser data * @return boolean Response */ public static function InterpretParam($data){ if($data['method']=='') return true; $info=explode(' ',$data['keyword'][1],3); if(sizeof($info)<2) return true; $name=substr($info[1],1); if(substr($name,strlen($name)-1,1)==';') $name=substr($name,0,strlen($name)-1); PhpWsdl::Debug('Interpret parameter '.$name); if($data['server']->ParseDocs) if(sizeof($info)>2) $data['settings']['docs']=trim($info[2]); $data['param'][]=new PhpWsdlParam($name,$info[0],$data['settings']); $data['settings']=Array(); return false; } /** * Interpret a return value * * @param array $data The parser data * @return boolean Response */ public static function InterpretReturn($data){ if($data['method']=='') return true; $info=explode(' ',$data['keyword'][1],2); if(sizeof($info)<1) return true; PhpWsdl::Debug('Interpret return'); if($data['server']->ParseDocs) if(sizeof($info)>1) $data['settings']['docs']=trim($info[1]); $data['return']=new PhpWsdlParam(str_replace('%method%',$data['method'],self::$DefaultReturnName),$info[0],$data['settings']); $data['settings']=Array(); return false; } }