/** * Add a mixin to the class hierarchy, or extend one object with * a decorator * * @param mixed $classOrObject class or object to extend * @param string $extensionClassOrObject class to mix into $classOrObject */ function __mf_extend($classOrObject, $extensionClassOrObject) { if (is_object($classOrObject)) { // we are adding a decorator to an object constraint_mustBeExtensible($classOrObject); constraint_mustBeObject($extensionClassOrObject); $classOrObject->addDecorator($extensionClassOrObject); } else { // we are adding a mixin to the class hierarchy MF_Obj_MixinsManager::extend($classOrObject)->withClass($extensionClassOrObject); } }
public function __construct($extending) { constraint_mustBeObject($extending); $this->extending = $extending; }
public function usingObject($name, $obj) { constraint_mustBeObject($obj); $this->objects[$name] = $obj; // fluid interface return $this; }