Exemple #1
0
protected static function call ($database, $module, $method, $data)
{
/*rts*/	$rts_prevtimer = microtime(true) - self::$rts_call_stamp;
/*rts*/	self::$rts_call_stamp = microtime(true);

	array_push(self::$stack, compact('database', 'module', 'method'));
	try
	{
		$instance = self::instantiate_module($module);
		if (!is_null($database))
		$instance = self::instantiate_broker($module, $database, $instance);

/*xsc*/		if (!is_callable(array($instance, $method)))
/*xsc*/			throw is_null($database)
/*xsc*/				? new coren_exception_no_module_method("Can not call method '{$method}' of module '{$module}' because this method does not exist.")
/*xsc*/				: new coren_exception_no_broker_method("Can not call method '{$method}' of broker '{$module}' because this method does not exist.");

		if (!is_array($data)) $data = is_null($data) ? array() : array(self::default_data_key => $data);
		$result = call_user_func(array($instance, $method), $data);
	}
	catch (exception $exception) {}
	array_pop(self::$stack);

/*rts*/	$rts_leave = microtime(true);
/*rts*/	if (isset(self::$module_names[$module]))
/*rts*/	{
/*rts*/		$rts_timer = $rts_leave - self::$rts_call_stamp;
/*rts*/		self::$rts_time_for_module[$module] += $rts_timer;
/*rts*/		self::$rts_count_of_module[$module] ++;
/*rts*/		if (!isset(self::$rts_time_for_method[$module][$method]))
/*rts*/		{
/*rts*/			self::$rts_time_for_method[$module][$method] = 0.0;
/*rts*/			self::$rts_count_of_method[$module][$method] = 0;
/*rts*/		}
/*rts*/		self::$rts_time_for_method[$module][$method] += $rts_timer;
/*rts*/		self::$rts_count_of_method[$module][$method] ++;
/*rts*/	}
/*rts*/	self::$rts_call_stamp = microtime(true) - $rts_prevtimer;

	if (isset($exception)) throw $exception;
	return $result;
}