<?php

function add_class_hook( $class, $method, $callback ) {
	global $hooks;
	$hooks['class'][$class][$method] = $callback;
}

function hook___construct( $obj, $args ) {
	$obj->user = array(
		     'name' => 'maria',
		     'surname' => 'madalena'
		     );
}

add_class_hook( 'big_user', '__construct', 'hook___construct' );

function hook_print_user( $obj, $args ) {
	$obj->user['name'] .= '1';
	$obj->user['surname'] .= '1';
	
	return false;
}

add_class_hook( 'big_user', 'print_user', 'hook_print_user' );

function hook_get_user( $obj, $args ) {
	$obj->user['where'] = 'hook_get_user';
	return $obj;
}

add_class_hook( 'big_user', 'get_user', 'hook_get_user' );

function class_hooker( $obj, $class, $method, $args ) {
	global $hooks;

	if ( isset( $hooks['class'][$class][$method] )) {
		return $hooks['class'][$class][$method]( $obj, $args );
	}
}

define( 'class_hook_handler', 'class_hooker' );

include( 'user.php' );

echo( '<pre>' );
$user = new big_user;
$user->print_user( );
var_dump( $user->get_user( ));
var_dump( $user );

global $hooks;
var_dump( $hooks );
//big_user( );
