function getIntrospectionXML() 
	{
		$xml = "<?xml version='1.0' ?><introspection version='1.0'><methodList>";
		if ( isset($this->methods) && is_array( $this->methods ) )
		{
			foreach ($this->methods as $method => $methodData )
			{
				if ( is_array( $methodData['call'] ) )
				{
					$reflection = new ReflectionMethod( 
						$methodData['call'][0], 
						$methodData['call'][1] 
					);
				}
				else
				{
					$reflection = new ReflectionFunction( $methodData['call'] );
				}
				$description = $reflection->getDocComment();
				if ( $description && $this->docCommentParser ) 
				{
					$data = $this->docCommentParser->parse( $description );
					if ($data['description']) 
					{
						$description = $data['description'];
					}
				}
				if ($description) 
				{
					$description = '<p>' . str_replace( array( "\r\n\r\n", "\n\n") , '</p><p>', $description) 
						. '</p>';
				}
				if ( is_array( $data ) ) 
				{
					foreach( $data as $key => $value ) 
					{
						switch( $key ) 
						{
							case 'category' :
							case 'deprecated' :
							case 'package' :
								$description .= '<div class="' . $key . '"><span class="tag">' 
									. $key . '</span>' . $value .'</div>';
							break;
							
							default :
							break;
						}
					}
				}
				$xml .= '<methodDescription name="' . $method . '"><purpose><![CDATA[' 
					. $description . ']]></purpose>';
				if ( is_array( $data ) && ( isset( $data['arguments'] ) || isset( $data['return'] ) ) ) 
				{
					$xml .= '<signatures><signature>';
					if ( isset( $data['arguments'] ) && is_array($data['arguments']) ) 
					{
						$xml .= '<params>';
						foreach ( $data['arguments'] as $name => $argument ) 
						{
							if ( $name[0] == '$' ) 
							{
								$name = substr( $name, 1 );
							}
							$xml .= '<value type="' . htmlspecialchars( $argument['type'] ) 
								. '" name="' . htmlspecialchars( $name ) . '"><![CDATA[' . $argument['description'] 
								. ']]></value>';
						}
						$xml .= '</params>';
					}
					if ( isset( $data['return'] ) && is_array( $data['return'] ) ) 
					{
						$xml .= '<returns><value type="' . htmlspecialchars($data['return']['type']) 
						. '"><![CDATA[' . $data['return']['description'] . ']]></value></returns>';
					}
					$xml .= '</signature></signatures>';
				}
				$xml .=  '</methodDescription>';
			}
		}	
		$xml .= "</methodList></introspection>";
		return $xml;
	}
function getIntrospectionXML() 
	{
		$xml = "<?xml version='1.0' ?><introspection version='1.0'><methodList>";
		if ( isset($this->methods) && is_array( $this->methods ) )
		{
			foreach ($this->methods as $method => $methodData )
			{
				if ( is_array( $methodData['call'] ) )
				{
					$reflection = new ReflectionMethod( 
						$methodData['call'][0], 
						$methodData['call'][1] 
					);
				}
				else
				{
					$reflection = new ReflectionFunction( $methodData['call'] );
				}
				$description = $reflection->getDocComment();
				if ( $description && $this->docCommentParser ) 
				{
					$data = $this->docCommentParser->parse( $description );
					if ($data['description']) 
					{
						$description = $data['description'];
					}
				}
				if ($description) 
				{
					$description = '<p>' . str_replace( array( "\r\n\r\n", "\n\n") , '</p><p>', $description) 
						. '</p>';
				}
				if ( is_array( $data ) ) 
				{
					foreach( $data as $key => $value ) 
					{
						switch( $key ) 
						{
							case 'category' :
							case 'deprecated' :
							case 'package' :
								$description .= '<div class="' . $key . '"><span class="tag">' 
									. $key . '</span>' . $value .'</div>';
							break;
							
							default :
							break;
						}
					}
				}
				$xml .= '<methodDescription name="' . $method . '"><purpose><![CDATA[' 
					. $description . ']]></purpose>';
				if ( is_array( $data ) && ( isset( $data['arguments'] ) || isset( $data['return'] ) ) ) 
				{
					$xml .= '<signatures><signature>';
					if ( isset( $data['arguments'] ) && is_array($data['arguments']) ) 
					{
						$xml .= '<params>';
						foreach ( $data['arguments'] as $name => $argument ) 
						{
							if ( $name[0] == '$' ) 
							{
								$name = substr( $name, 1 );
							}
							$xml .= '<value type="' . htmlspecialchars( $argument['type'] ) 
								. '" name="' . htmlspecialchars( $name ) . '"><![CDATA[' . $argument['description'] 
								. ']]></value>';
						}
						$xml .= '</params>';
					}
					if ( isset( $data['return'] ) && is_array( $data['return'] ) ) 
					{
						$xml .= '<returns><value type="' . htmlspecialchars($data['return']['type']) 
						. '"><![CDATA[' . $data['return']['description'] . ']]></value></returns>';
					}
					$xml .= '</signature></signatures>';
				}
				$xml .=  '</methodDescription>';
			}
		}	
		$xml .= "</methodList></introspection>";
		return $xml;
	}
function getIntrospectionXML ( ) { $ xml = "<?xml version='1.0' ?><introspection version='1.0'><methodList>" ; if ( isset ( $ this -> methods ) && is_array ( $ this -> methods ) ) { foreach ( $ this -> methods as $ method => $ methodData ) { if ( is_array ( $ methodData [ 'call' ] ) ) { $ reflection = new ReflectionMethod ( $ methodData [ 'call' ] [ 0 ] , $ methodData [ 'call' ] [ 1 ] ) ; } else { $ reflection = new ReflectionFunction ( $ methodData [ 'call' ] ) ; } $ description = $ reflection -> getDocComment ( ) ; if ( $ description && $ this -> docCommentParser ) { $ data = $ this -> docCommentParser -> parse ( $ description ) ; if ( $ data [ 'description' ] ) { $ description = $ data [ 'description' ] ; } } if ( $ description ) { $ description = '<p>' . str_replace ( array ( "\r\n\r\n" , "\n\n" ) , '</p><p>' , $ description ) . '</p>' ; } if ( is_array ( $ data ) ) { foreach ( $ data as $ key => $ value ) { switch ( $ key ) { case 'category' : case 'deprecated' : case 'package' : $ description .= '<div class="' . $ key . '"><span class="tag">' . $ key . '</span>' . $ value . '</div>' ; break ; default : break ; } } } $ xml .= '<methodDescription name="' . $ method . '"><purpose><![CDATA[' . $ description . ']]></purpose>' ; if ( is_array ( $ data ) && ( isset ( $ data [ 'arguments' ] ) || isset ( $ data [ 'return' ] ) ) ) { $ xml .= '<signatures><signature>' ; if ( isset ( $ data [ 'arguments' ] ) && is_array ( $ data [ 'arguments' ] ) ) { $ xml .= '<params>' ; foreach ( $ data [ 'arguments' ] as $ name => $ argument ) { if ( $ name [ 0 ] == '$' ) { $ name = substr ( $ name , 1 ) ; } $ xml .= '<value type="' . htmlspecialchars ( $ argument [ 'type' ] ) . '" name="' . htmlspecialchars ( $ name ) . '"><![CDATA[' . $ argument [ 'description' ] . ']]></value>' ; } $ xml .= '</params>' ; } if ( isset ( $ data [ 'return' ] ) && is_array ( $ data [ 'return' ] ) ) { $ xml .= '<returns><value type="' . htmlspecialchars ( $ data [ 'return' ] [ 'type' ] ) . '"><![CDATA[' . $ data [ 'return' ] [ 'description' ] . ']]></value></returns>' ; } $ xml .= '</signature></signatures>' ; } $ xml .= '</methodDescription>' ; } } $ xml .= "</methodList></introspection>" ; return $ xml ; }
This method returns an XML document in the introspection format expected by
xmlrpc_server_register_introspection_callback. It uses the php Reflection
classes to gather information from the registered methods.
Descriptions are added from phpdoc docblocks if found.
@return string XML string with the introspection data.
This method returns an XML document in the introspection format expected by xmlrpc_server_register_introspection_callback . It uses the php Reflection classes to gather information from the registered methods . Descriptions are added from phpdoc docblocks if found .