src/UI/HTML/Tag.php
public static function create( $name, $content = NULL, $attributes = array(), $data = array() )
	{
		if( !strlen( $name	= trim( $name ) ) )
			throw new InvalidArgumentException( 'Missing tag name' );
		$name		= strtolower( $name );
		try{
			$attributes	= self::renderAttributes( $attributes );
			$data		= self::renderData( $data );
		}
		catch( InvalidArgumentException $e ) {
			if( version_compare( PHP_VERSION, '5.3.0', '>=' ) )
				throw new RuntimeException( 'Invalid attributes', NULL, $e );						//  throw exception and transport inner exception
			throw new RuntimeException( 'Invalid attributes', NULL );								//  throw exception
		}
		if( $content === NULL || $content === FALSE )												//  no node content defined, not even an empty string
			if( !in_array( $name, self::$shortTagExcludes ) )										//  node name is allowed to be a short tag
				return "<".$name.$attributes.$data."/>";											//  build and return short tag
		if( is_array( $content ) )																	//  content is an array, may be nested
			$content	= self::flattenArray( $content, '' );
		if( is_numeric( $content ) )
			$content	= (string) $content;
		if( is_object( $content ) ){
			if( !method_exists( $content, '__toString' ) ){											//  content is not a renderable object
				$message	= 'Object of class "'.get_class( $content ).'" cannot be rendered';		//  prepare message about not renderable object
				throw new InvalidArgumentException( $message ); 									//  break with error message
			}
			$content	= (string) $content;														//  render object to string
		}
		if( !is_null( $content ) && !is_string( $content ) ){										//  content is neither NULL nor string so far
			$message	= 'Content type "'.gettype( $content ).'" is not supported';				//  prepare message about wrong content data type
			throw new InvalidArgumentException( $message ); 										//  break with error message
		}
		return "<".$name.$attributes.$data.">".$content."</".$name.">";								//  build and return full tag
	}
public static function create( $name, $content = NULL, $attributes = array(), $data = array() )
	{
		if( !strlen( $name	= trim( $name ) ) )
			throw new InvalidArgumentException( 'Missing tag name' );
		$name		= strtolower( $name );
		try{
			$attributes	= self::renderAttributes( $attributes );
			$data		= self::renderData( $data );
		}
		catch( InvalidArgumentException $e ) {
			if( version_compare( PHP_VERSION, '5.3.0', '>=' ) )
				throw new RuntimeException( 'Invalid attributes', NULL, $e );						//  throw exception and transport inner exception
			throw new RuntimeException( 'Invalid attributes', NULL );								//  throw exception
		}
		if( $content === NULL || $content === FALSE )												//  no node content defined, not even an empty string
			if( !in_array( $name, self::$shortTagExcludes ) )										//  node name is allowed to be a short tag
				return "<".$name.$attributes.$data."/>";											//  build and return short tag
		if( is_array( $content ) )																	//  content is an array, may be nested
			$content	= self::flattenArray( $content, '' );
		if( is_numeric( $content ) )
			$content	= (string) $content;
		if( is_object( $content ) ){
			if( !method_exists( $content, '__toString' ) ){											//  content is not a renderable object
				$message	= 'Object of class "'.get_class( $content ).'" cannot be rendered';		//  prepare message about not renderable object
				throw new InvalidArgumentException( $message ); 									//  break with error message
			}
			$content	= (string) $content;														//  render object to string
		}
		if( !is_null( $content ) && !is_string( $content ) ){										//  content is neither NULL nor string so far
			$message	= 'Content type "'.gettype( $content ).'" is not supported';				//  prepare message about wrong content data type
			throw new InvalidArgumentException( $message ); 										//  break with error message
		}
		return "<".$name.$attributes.$data.">".$content."</".$name.">";								//  build and return full tag
	}
public static function create ( $ name , $ content = NULL , $ attributes = array ( ) , $ data = array ( ) ) { if ( ! strlen ( $ name = trim ( $ name ) ) ) throw new InvalidArgumentException ( 'Missing tag name' ) ; $ name = strtolower ( $ name ) ; try { $ attributes = self :: renderAttributes ( $ attributes ) ; $ data = self :: renderData ( $ data ) ; } catch ( InvalidArgumentException $ e ) { if ( version_compare ( PHP_VERSION , '5.3.0' , '>=' ) ) throw new RuntimeException ( 'Invalid attributes' , NULL , $ e ) ; //  throw exception and transport inner exception throw new RuntimeException ( 'Invalid attributes' , NULL ) ; //  throw exception } if ( $ content === NULL || $ content === FALSE ) //  no node content defined, not even an empty string if ( ! in_array ( $ name , self :: $ shortTagExcludes ) ) //  node name is allowed to be a short tag return "<" . $ name . $ attributes . $ data . "/>" ; //  build and return short tag if ( is_array ( $ content ) ) //  content is an array, may be nested $ content = self :: flattenArray ( $ content , '' ) ; if ( is_numeric ( $ content ) ) $ content = ( string ) $ content ; if ( is_object ( $ content ) ) { if ( ! method_exists ( $ content , '__toString' ) ) { //  content is not a renderable object $ message = 'Object of class "' . get_class ( $ content ) . '" cannot be rendered' ; //  prepare message about not renderable object throw new InvalidArgumentException ( $ message ) ; //  break with error message } $ content = ( string ) $ content ; //  render object to string } if ( ! is_null ( $ content ) && ! is_string ( $ content ) ) { //  content is neither NULL nor string so far $ message = 'Content type "' . gettype ( $ content ) . '" is not supported' ; //  prepare message about wrong content data type throw new InvalidArgumentException ( $ message ) ; //  break with error message } return "<" . $ name . $ attributes . $ data . ">" . $ content . "</" . $ name . ">" ; //  build and return full tag }
Creates Tag statically.
@access		public
@static
@param		string		$name			Node name of tag
@param		string		$content		Content of tag
@param		array		$attributes		Attributes of tag
@param		array		$data			Data attributes of tag
@return		void
Creates Tag statically .