Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Returns true if the caller is to go ahead with default behavior, false if it is to skip.
- * The method is passed a reference to $caller, plus any additional arguments supplied.
- */
- function lqtDelegate( $caller, $delegate, $methodName ) {
- if( !$delegate ) return true;
- // Build an array from the extra arguments.
- // In any case, include $caller in the arguments.
- $extra_args = array( &$caller );
- for ( $i = 3; $i < func_num_args(); $i++ ) {
- $extra_args[] = &func_get_arg($i);
- }
- $refl = new ReflectionObject( $delegate );
- if ( $refl->hasMethod( $methodName ) ) {
- return call_user_func_array( array( $delegate, $methodName ), $extra_args );
- } else {
- return true;
- }
- }
Add Comment
Please, Sign In to add comment