4 * This is a quick-and-dirty way to define a vaguely-class-ish structure. It's non-performant, abnormal,
5 * and not a complete OOP system. Only use for testing/mocking.
8 * $object = new CRM_Utils_FakeObject(array(
9 * 'doIt' => function() { print "It!\n"; }
14 class CRM_Utils_FakeObject
{
18 function __construct($array) {
19 $this->array = $array;
28 function __call($name, $arguments) {
29 if (isset($this->array[$name]) && is_callable($this->array[$name])) {
30 return call_user_func_array($this->array[$name], $arguments);
32 throw new Exception("Call to unimplemented method: $name");