public function submitJob($params, $cb = null)
    {
        $closure = function () use (&$params, $cb) {
            $this->sendCommand(
                'SUBMIT_JOB'
                . (isset($params['pri']) ? '_ ' . strtoupper($params['pri']) : '')
                . (isset($params['bg']) && $params['bg'] ? '_BG' : ''),
                [$params['function'], $params['unique'], $params['payload']],
                $cb
            );
        };
        if (isset($params['unique'])) {
            $closure();
        } else {
            Crypt::randomString(
                10,
                '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
                function ($random) use ($closure) {
                    $params['unique'] = $random;
                    $closure();
                }
            );
        }
    }
public function submitJob($params, $cb = null)
    {
        $closure = function () use (&$params, $cb) {
            $this->sendCommand(
                'SUBMIT_JOB'
                . (isset($params['pri']) ? '_ ' . strtoupper($params['pri']) : '')
                . (isset($params['bg']) && $params['bg'] ? '_BG' : ''),
                [$params['function'], $params['unique'], $params['payload']],
                $cb
            );
        };
        if (isset($params['unique'])) {
            $closure();
        } else {
            Crypt::randomString(
                10,
                '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
                function ($random) use ($closure) {
                    $params['unique'] = $random;
                    $closure();
                }
            );
        }
    }
public function submitJob ( $ params , $ cb = null ) { $ closure = function ( ) use ( & $ params , $ cb ) { $ this -> sendCommand ( 'SUBMIT_JOB' . ( isset ( $ params [ 'pri' ] ) ? '_ ' . strtoupper ( $ params [ 'pri' ] ) : '' ) . ( isset ( $ params [ 'bg' ] ) && $ params [ 'bg' ] ? '_BG' : '' ) , [ $ params [ 'function' ] , $ params [ 'unique' ] , $ params [ 'payload' ] ] , $ cb ) ; } ; if ( isset ( $ params [ 'unique' ] ) ) { $ closure ( ) ; } else { Crypt :: randomString ( 10 , '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' , function ( $ random ) use ( $ closure ) { $ params [ 'unique' ] = $ random ; $ closure ( ) ; } ) ; } }
Function run task and wait result in callback

@param $params
@param callable $cb = null
@param boolean $unique
Function run task and wait result in callback