Callback.php
public static function call($callback, array $args = null)
    {
        $callback = Helper::toNative($callback);
        if ($callback['bind']) {
            $native = $callback['native'];
            $first = $native[0];
            if (is_object($first)) {
                $callback = Helper::bindInstance($first, $native[1], $callback['args']);
            } elseif (is_string($first)) {
                $callback = Helper::bindStatic($first, $native[1], $callback['args']);
            } else {
                throw new InvalidFormat('Invalid callback for bind context');
            }
        } else {
            $args = array_merge($callback['args'], $args ?: []);
            $callback = $callback['native'];
            if (!is_callable($callback, false)) {
                throw new NotCallable();
            }
        }
        return call_user_func_array($callback, $args ?: []);
    }
public static function call($callback, array $args = null)
    {
        $callback = Helper::toNative($callback);
        if ($callback['bind']) {
            $native = $callback['native'];
            $first = $native[0];
            if (is_object($first)) {
                $callback = Helper::bindInstance($first, $native[1], $callback['args']);
            } elseif (is_string($first)) {
                $callback = Helper::bindStatic($first, $native[1], $callback['args']);
            } else {
                throw new InvalidFormat('Invalid callback for bind context');
            }
        } else {
            $args = array_merge($callback['args'], $args ?: []);
            $callback = $callback['native'];
            if (!is_callable($callback, false)) {
                throw new NotCallable();
            }
        }
        return call_user_func_array($callback, $args ?: []);
    }
public static function call ( $ callback , array $ args = null ) { $ callback = Helper :: toNative ( $ callback ) ; if ( $ callback [ 'bind' ] ) { $ native = $ callback [ 'native' ] ; $ first = $ native [ 0 ] ; if ( is_object ( $ first ) ) { $ callback = Helper :: bindInstance ( $ first , $ native [ 1 ] , $ callback [ 'args' ] ) ; } elseif ( is_string ( $ first ) ) { $ callback = Helper :: bindStatic ( $ first , $ native [ 1 ] , $ callback [ 'args' ] ) ; } else { throw new InvalidFormat ( 'Invalid callback for bind context' ) ; } } else { $ args = array_merge ( $ callback [ 'args' ] , $ args ? : [ ] ) ; $ callback = $ callback [ 'native' ] ; if ( ! is_callable ( $ callback , false ) ) { throw new NotCallable ( ) ; } } return call_user_func_array ( $ callback , $ args ? : [ ] ) ; }
Executes a callback

@param mixed $callback
a callback in the extended format
@param array $args [optional]
an argument list of the call
@return mixed
the result of the call
@throws \axy\callbacks\errors\InvalidFormat
invalid format of the callback
@throws \axy\callbacks\errors\NotCallable
the callback is not callable
Executes a callback