-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,29 @@ | ||
|
||
<?php | ||
abstract class Extender { | ||
private $_exts = array(); | ||
public $_this; | ||
function __construct() { | ||
$_this = $this; | ||
} | ||
public function add_ext($object) { | ||
$this->_exts[] = $object; | ||
} | ||
public function __get($var_name) { | ||
foreach($this->_exts as $ext) { | ||
if (property_exists($ext, $var_name)) { | ||
return $ext->$varname; | ||
} | ||
} | ||
} | ||
public function __call($method, $args) { | ||
foreach($this->_exts as $ext) { | ||
if (method_exists($ext, $method)) { | ||
return call_user_method_array($method,$ext,$args); | ||
} | ||
} | ||
throw new Exception("This Method {$method} doesn't exists"); | ||
} | ||
|
||
|
||
} | ||
?> |