Created
April 9, 2013 07:58
-
-
Save julianwachholz/5343823 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| <?php | |
| function _applyPlugin($function, $args) { | |
| foreach ($this->plugins as $plugin) { | |
| if (method_exists($plugin, $function)) { | |
| switch (count($args)) { // call_user_func_array() doesn't work well with references | |
| case 0: $return = $plugin->$function(); break; | |
| case 1: $return = $plugin->$function($args[0]); break; | |
| case 2: $return = $plugin->$function($args[0], $args[1]); break; | |
| case 3: $return = $plugin->$function($args[0], $args[1], $args[2]); break; | |
| case 4: $return = $plugin->$function($args[0], $args[1], $args[2], $args[3]); break; | |
| case 5: $return = $plugin->$function($args[0], $args[1], $args[2], $args[3], $args[4]); break; | |
| case 6: $return = $plugin->$function($args[0], $args[1], $args[2], $args[3], $args[4], $args[5]); break; | |
| default: trigger_error('Too many parameters.', E_USER_WARNING); | |
| } | |
| if ($return !== null) { | |
| return $return; | |
| } | |
| } | |
| } | |
| return $this->_callParent($function, $args); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment