protected function _invokeCallable($callable, $args)
    {
        if (!is_callable($callable)) {
            throw $this->_createInvalidArgumentException($this->__('Callable is not callable'), null, null, $callable);
        }

        $args = $this->_normalizeArray($args);

        try {
            $reflection = $this->_createReflectionForCallable($callable);
            $params     = $reflection->getParameters();
            $this->_validateParams($args, $params);
        } catch (RootException $e) {
            throw $this->_createInvocationException($this->__('Could not invoke callable'), null, $e, $callable, $args);
        }

        // Invoke the callable
        try {
            if ($reflection instanceof ReflectionMethod) {
                if (is_object($callable)) {
                    $target = $callable;
                } else {
                    $target = is_object($callable[0])
                        ? $callable[0]
                        : null;
                }

                return $reflection->invokeArgs($target, $args);
            } else {
                return call_user_func_array($callable, $args);
            }
        } catch (RootException $e) {
            throw $this->_createInternalException(
                $this->__('There was an error during invocation'),
                null,
                $e
            );
        }
    }
protected function _invokeCallable($callable, $args)
    {
        if (!is_callable($callable)) {
            throw $this->_createInvalidArgumentException($this->__('Callable is not callable'), null, null, $callable);
        }

        $args = $this->_normalizeArray($args);

        try {
            $reflection = $this->_createReflectionForCallable($callable);
            $params     = $reflection->getParameters();
            $this->_validateParams($args, $params);
        } catch (RootException $e) {
            throw $this->_createInvocationException($this->__('Could not invoke callable'), null, $e, $callable, $args);
        }

        // Invoke the callable
        try {
            if ($reflection instanceof ReflectionMethod) {
                if (is_object($callable)) {
                    $target = $callable;
                } else {
                    $target = is_object($callable[0])
                        ? $callable[0]
                        : null;
                }

                return $reflection->invokeArgs($target, $args);
            } else {
                return call_user_func_array($callable, $args);
            }
        } catch (RootException $e) {
            throw $this->_createInternalException(
                $this->__('There was an error during invocation'),
                null,
                $e
            );
        }
    }
protected function _invokeCallable ( $ callable , $ args ) { if ( ! is_callable ( $ callable ) ) { throw $ this -> _createInvalidArgumentException ( $ this -> __ ( 'Callable is not callable' ) , null , null , $ callable ) ; } $ args = $ this -> _normalizeArray ( $ args ) ; try { $ reflection = $ this -> _createReflectionForCallable ( $ callable ) ; $ params = $ reflection -> getParameters ( ) ; $ this -> _validateParams ( $ args , $ params ) ; } catch ( RootException $ e ) { throw $ this -> _createInvocationException ( $ this -> __ ( 'Could not invoke callable' ) , null , $ e , $ callable , $ args ) ; } // Invoke the callable try { if ( $ reflection instanceof ReflectionMethod ) { if ( is_object ( $ callable ) ) { $ target = $ callable ; } else { $ target = is_object ( $ callable [ 0 ] ) ? $ callable [ 0 ] : null ; } return $ reflection -> invokeArgs ( $ target , $ args ) ; } else { return call_user_func_array ( $ callable , $ args ) ; } } catch ( RootException $ e ) { throw $ this -> _createInternalException ( $ this -> __ ( 'There was an error during invocation' ) , null , $ e ) ; } }
Invokes a callable.

@since [*next-version*]

@param callable                   $callable The callable to invoke.
@param array|Traversable|stdClass $args     The arguments to invoke the callable with.

@throws InvalidArgumentException     If the callable is not callable.
@throws InvalidArgumentException     If the args are not a valid list.
@throws InvocationExceptionInterface If the callable cannot be invoked.
@throws InternalExceptionInterface   If a problem occurs during invocation.

@return mixed The result of the invocation.
Invokes a callable .