Skip to content

Instantly share code, notes, and snippets.

@skurfuerst
Created March 22, 2011 11:32
Show Gist options
  • Save skurfuerst/881090 to your computer and use it in GitHub Desktop.
Save skurfuerst/881090 to your computer and use it in GitHub Desktop.
eval('
' . $abstractModifier . 'class ' . $accessibleClassName . ' extends ' . $className . ' {
public function _call($methodName) {
$args = func_get_args();
return call_user_func_array(array($this, $methodName), array_slice($args, 1));
}
public function _callRef($methodName, &$arg1 = NULL, &$arg2 = NULL, &$arg3 = NULL, &$arg4 = NULL, &$arg5= NULL, &$arg6 = NULL, &$arg7 = NULL, &$arg8 = NULL, &$arg9 = NULL) {
switch (func_num_args()) {
case 0 : return $this->$methodName();
case 1 : return $this->$methodName($arg1);
case 2 : return $this->$methodName($arg1, $arg2);
case 3 : return $this->$methodName($arg1, $arg2, $arg3);
case 4 : return $this->$methodName($arg1, $arg2, $arg3, $arg4);
case 5 : return $this->$methodName($arg1, $arg2, $arg3, $arg4, $arg5);
case 6 : return $this->$methodName($arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
case 7 : return $this->$methodName($arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $arg7);
case 8 : return $this->$methodName($arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $arg7, $arg8);
case 9 : return $this->$methodName($arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $arg7, $arg8, $arg9);
}
}
public function _set($propertyName, $value) {
$this->$propertyName = $value;
}
public function _setRef($propertyName, &$value) {
$this->$propertyName = $value;
}
public function _get($propertyName) {
return $this->$propertyName;
}
}
');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment