Location: PHPKode > scripts > PAX > pax/core/classes/Node.class.php
<?php

/**
 * Page DocBlock definition
 * @package org.zadara.marius.pax
 */

/**
 * PAX general node definition.
 * This class is the root of all PAX nodes.
 * 
 * @author Marius Zadara <hide@address.com>
 * @category Classes
 * @copyright (C) 2008-2009 Marius Zadara
 * @license Free for non-comercial use
 * @package org.zadara.marius.pax
 * @abstract 
 * @see PAXObject
 * @see INode
 * @version 6.0
 * @since 5.0
 */
abstract class Node extends PAXObject implements INode  
{
	/**
	 * User object reference.
	 *
	 * @access protected
	 * @var object
	 */
	protected $userObject;
	
	
	/**
	 * Current node attributes.
	 *
	 * @access protected
	 * @var array
	 */
	protected $attributes;
	
	
	
	/**
	 * Current node content
	 *
	 * @access protected
	 * @var string
	 */
	protected $content;
	
	
	/**
	 * Node constructor.
	 *
	 * @access public
	 */
	public function __construct()
	{
		// init the parent
		parent::__construct();
		
		// init the user object and the attributes
		$this->userObject = null;
		$this->attributes = null;
		$this->content = null;
	}		

	/**
	 * Method to set the user object.
	 *
	 * @access public
	 * @final 
	 * @param object <b>$userObject</b> The user custom object
	 * @return void
	 */
	public final function setUserObject(&$userObject)
	{
		// set the object to the class member
		$this->userObject = $userObject;
	}
			
	
	/**
	 * Method to set the current attributes
	 *
	 * @access public
	 * @final 
	 * @param array <b>$attributes</b> List of the attributes
	 * @return void
	 */
	public final function setAttributes(&$attributes)
	{
		// set the current node's attributes to the class memeber
		if (is_array($attributes))
			$this->attributes = $attributes;
	}
	
	
	/**
	 * Method to set the content of the node.
	 *
	 * @access public
	 * @final 
	 * @param string <b>$content</b> The content of the node
	 * @return void
	 */
	public final function setContent($content)
	{
	    // set the content of the node
	    $this->content = $content;
	}
	
	
	/**
	 * Method to reset the attributes to a null value.
	 *
	 * @access public
	 * @final 
	 * @return void
	 */
	public final function resetAttributes()
	{
	    // reset to null
	    $this->attributes = null;
	}
	
	
	/**
	 * Reset the node content to a null value
	 * 
	 * @access public
	 * @final 
	 * @return void
	 */
	public final function resetContent()
	{
	    // reset the content
	    $this->content = null;
	}
	
	
	
	/**
	 * Method to be called when the node starts.
	 * It will be overwritten by every node implementation
	 *
	 * @access public
	 * @abstract 
	 * @return void
	 */
	public abstract function onOpen();

	/**
	 * Method to be called when the tag is complete (short form).
	 *
	 * @access public
	 * @return void
	 */
	public function onComplete()
	{
		// call the open method
		$this->onOpen();
		
		// call the close method
		$this->onClose();
	}

	/**
	 * Method to be called when the tag is closed.
	 * It will be overwritten by every node implementation.
	 *
	 * @access public
	 * @abstract 
	 */
	public abstract function onClose();

	
	/**
	 * Class destructor.
	 */
	function __destruct()
	{
			
	}		
}

?>
Return current item: PAX