3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
19 * This is a quick-and-dirty way to define a vaguely-class-ish structure. It's non-performant, abnormal,
20 * and not a complete OOP system. Only use for testing/mocking.
23 * $object = new CRM_Utils_FakeObject(array(
24 * 'doIt' => function() { print "It!\n"; }
29 class CRM_Utils_FakeObject
{
34 public function __construct($array) {
35 $this->array = $array;
44 public function __call($name, $arguments) {
45 if (isset($this->array[$name]) && is_callable($this->array[$name])) {
46 return call_user_func_array($this->array[$name], $arguments);
49 throw new Exception("Call to unimplemented method: $name");