src/Requests/Application/ScanRequests.php
public function blockUntilDone(
        $appId,
        $scanId,
        $waitTime = 0,
        $sleepTime = 5,
        array $queryParams = []
    ) {
        for ($iteration = 0;; $iteration++) {
            $scanResponse = $this->getById($appId, $scanId, $queryParams);
            $scan = $scanResponse->getDecodedData();

            if ((int) $scan->phase === 0 && (int) $scan->percent === 100) {
                return $scanResponse;
            } else if ($waitTime > 0 && $iteration > ($waitTime / $sleepTime)) {
                throw new \Exception('Scan did not finish before the defined wait time.');
            }

            sleep($sleepTime);
        }

        throw new \Exception('blockUntilDone unexpected state');
    }
public function blockUntilDone(
        $appId,
        $scanId,
        $waitTime = 0,
        $sleepTime = 5,
        array $queryParams = []
    ) {
        for ($iteration = 0;; $iteration++) {
            $scanResponse = $this->getById($appId, $scanId, $queryParams);
            $scan = $scanResponse->getDecodedData();

            if ((int) $scan->phase === 0 && (int) $scan->percent === 100) {
                return $scanResponse;
            } else if ($waitTime > 0 && $iteration > ($waitTime / $sleepTime)) {
                throw new \Exception('Scan did not finish before the defined wait time.');
            }

            sleep($sleepTime);
        }

        throw new \Exception('blockUntilDone unexpected state');
    }
public function blockUntilDone ( $ appId , $ scanId , $ waitTime = 0 , $ sleepTime = 5 , array $ queryParams = [ ] ) { for ( $ iteration = 0 ; ; $ iteration ++ ) { $ scanResponse = $ this -> getById ( $ appId , $ scanId , $ queryParams ) ; $ scan = $ scanResponse -> getDecodedData ( ) ; if ( ( int ) $ scan -> phase === 0 && ( int ) $ scan -> percent === 100 ) { return $ scanResponse ; } else if ( $ waitTime > 0 && $ iteration > ( $ waitTime / $ sleepTime ) ) { throw new \ Exception ( 'Scan did not finish before the defined wait time.' ) ; } sleep ( $ sleepTime ) ; } throw new \ Exception ( 'blockUntilDone unexpected state' ) ; }
Block until scan is finished

@param int $appId
@param int $scanId
@param int $waitTime - Optional time to wait, will wait indefinitely if 0 (default: 0)
@param int $sleepTime - Time to wait between scan completion checks (default: 5)
@param array $queryParams
@return Response
@throws \Exception if scan does not finish in time
Block until scan is finished