Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MyClass {
- public function __call($name, $args) {
- switch ($name) {
- case 'funcOne':
- switch (count($args)) {
- case 1:
- return call_user_func_array(array($this, 'funcOneWithOneArg'), $args);
- case 3:
- return call_user_func_array(array($this, 'funcOneWithThreeArgs'), $args);
- }
- case 'anotherFunc':
- switch (count($args)) {
- case 0:
- return $this->anotherFuncWithNoArgs();
- case 5:
- return call_user_func_array(array($this, 'anotherFuncWithMoreArgs'), $args);
- }
- }
- }
- protected function funcOneWithOneArg($a) {
- }
- protected function funcOneWithThreeArgs($a, $b, $c) {
- }
- protected function anotherFuncWithNoArgs() {
- }
- protected function anotherFuncWithMoreArgs($a, $b, $c, $d, $e) {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement