PHPDaemon\DNode\DNode::ensureCallback PHP Method

ensureCallback() public static method

Ensures that the variable passed by reference holds a valid callback-function If it doesn't, its value will be reset to null
public static ensureCallback ( &$arg ) : boolean
return boolean
    public static function ensureCallback(&$arg)
    {
        if ($arg instanceof \Closure) {
            return true;
        }
        if (is_array($arg) && sizeof($arg) === 2) {
            if (isset($arg[0]) && $arg[0] instanceof \PHPDaemon\WebSocket\Route) {
                if (isset($arg[1]) && is_string($arg[1]) && strncmp($arg[1], 'remote_', 7) === 0) {
                    return true;
                }
            }
        }
        $arg = null;
        return false;
    }