Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class E2 {
- public function __construct(array $arguments = array()) {
- if (!empty($arguments)) {
- foreach ($arguments as $property => $argument) {
- $this->{$property} = $argument;
- }
- }
- }
- public function __call($method, $arguments) {
- $arguments = array_merge(array("E2" => $this), $arguments); // Note: method argument 0 will always referred to the main class ($this).
- if (isset($this->{$method}) && is_callable($this->{$method})) {
- return call_user_func_array($this->{$method}, $arguments);
- } else {
- throw new Exception("Fatal error: Call to undefined method E2 Object::{$method}()");
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement