<?php

/**
 * Hook object for accessing client side Javascript variables and object properties
 *
 * @version DR1.7
 */
class ResponseJsHook {



	private $_hook;
	private $_stack;



	public function __construct($property, ArrayObject $stack) {
		$this->_hook = $property;
		$this->_stack = $stack;
	}



	/**
	 * Returns hook for client side Javascript object property
	 */
	public function __call($method, $args) {
		$this->_stack[] = array($this->_hook . '.' . $method, $args);
	}



	/**
	 * Returns hook for client side Javascript variable
	 */
	public function __get($property) {
		return new ResponseJsHook($this->_hook . '.' . $property, $this->_stack);
	}



} // class ResponseJsHook

?>