public function process()
    {
        if ($this->isCapturing()) {
            $this->stopCapture();
        }
        $this->setBatchRequest(true);
        $data       = '';
        $batchParts = $this->getBatchParts();

        if (count($batchParts) === 0) {
            throw new ClientException('Can\'t process empty batch.');
        }

        $combinedDataHeader = '--' . HttpHelper::MIME_BOUNDARY . HttpHelper::EOL;
        $combinedDataHeader .= 'Content-Type: application/x-arango-batchpart' . HttpHelper::EOL;

        /** @var $partValue BatchPart */
        foreach ($batchParts as $partValue) {
            if (null !== $partValue) {

                $data .= $combinedDataHeader;
                if (null !== $partValueId = $partValue->getId()) {
                    $data .= 'Content-Id: ' . (string) $partValueId . HttpHelper::SEPARATOR;
                } else {
                    $data .= HttpHelper::EOL;
                }

                $data .= (string) $partValue->getRequest() . HttpHelper::EOL;
            }
        }

        $data .= '--' . HttpHelper::MIME_BOUNDARY . '--' . HttpHelper::SEPARATOR;

        $params               = [];
        $url                  = UrlHelper::appendParamsUrl(Urls::URL_BATCH, $params);
        $this->_batchResponse = $this->_connection->post($url, $data);

        if ($this->_batchResponse->getHttpCode() !== 200) {
            return $this->_batchResponse;
        }

        $body       = $this->_batchResponse->getBody();
        $body       = trim($body, '--' . HttpHelper::MIME_BOUNDARY . '--');
        $batchParts = $this->splitWithContentIdKey('--' . HttpHelper::MIME_BOUNDARY . HttpHelper::EOL, $body);

        foreach ($batchParts as $partKey => $partValue) {
            $response                     = new HttpResponse($partValue);
            $body                         = $response->getBody();
            $response                     = new HttpResponse($body);
            $batchPartResponses[$partKey] = $response;
            $this->getPart($partKey)->setResponse($batchPartResponses[$partKey]);
        }

        return $this;
    }
public function process()
    {
        if ($this->isCapturing()) {
            $this->stopCapture();
        }
        $this->setBatchRequest(true);
        $data       = '';
        $batchParts = $this->getBatchParts();

        if (count($batchParts) === 0) {
            throw new ClientException('Can\'t process empty batch.');
        }

        $combinedDataHeader = '--' . HttpHelper::MIME_BOUNDARY . HttpHelper::EOL;
        $combinedDataHeader .= 'Content-Type: application/x-arango-batchpart' . HttpHelper::EOL;

        /** @var $partValue BatchPart */
        foreach ($batchParts as $partValue) {
            if (null !== $partValue) {

                $data .= $combinedDataHeader;
                if (null !== $partValueId = $partValue->getId()) {
                    $data .= 'Content-Id: ' . (string) $partValueId . HttpHelper::SEPARATOR;
                } else {
                    $data .= HttpHelper::EOL;
                }

                $data .= (string) $partValue->getRequest() . HttpHelper::EOL;
            }
        }

        $data .= '--' . HttpHelper::MIME_BOUNDARY . '--' . HttpHelper::SEPARATOR;

        $params               = [];
        $url                  = UrlHelper::appendParamsUrl(Urls::URL_BATCH, $params);
        $this->_batchResponse = $this->_connection->post($url, $data);

        if ($this->_batchResponse->getHttpCode() !== 200) {
            return $this->_batchResponse;
        }

        $body       = $this->_batchResponse->getBody();
        $body       = trim($body, '--' . HttpHelper::MIME_BOUNDARY . '--');
        $batchParts = $this->splitWithContentIdKey('--' . HttpHelper::MIME_BOUNDARY . HttpHelper::EOL, $body);

        foreach ($batchParts as $partKey => $partValue) {
            $response                     = new HttpResponse($partValue);
            $body                         = $response->getBody();
            $response                     = new HttpResponse($body);
            $batchPartResponses[$partKey] = $response;
            $this->getPart($partKey)->setResponse($batchPartResponses[$partKey]);
        }

        return $this;
    }
public function process ( ) { if ( $ this -> isCapturing ( ) ) { $ this -> stopCapture ( ) ; } $ this -> setBatchRequest ( true ) ; $ data = '' ; $ batchParts = $ this -> getBatchParts ( ) ; if ( count ( $ batchParts ) === 0 ) { throw new ClientException ( 'Can\'t process empty batch.' ) ; } $ combinedDataHeader = '--' . HttpHelper :: MIME_BOUNDARY . HttpHelper :: EOL ; $ combinedDataHeader .= 'Content-Type: application/x-arango-batchpart' . HttpHelper :: EOL ; /** @var $partValue BatchPart */ foreach ( $ batchParts as $ partValue ) { if ( null !== $ partValue ) { $ data .= $ combinedDataHeader ; if ( null !== $ partValueId = $ partValue -> getId ( ) ) { $ data .= 'Content-Id: ' . ( string ) $ partValueId . HttpHelper :: SEPARATOR ; } else { $ data .= HttpHelper :: EOL ; } $ data .= ( string ) $ partValue -> getRequest ( ) . HttpHelper :: EOL ; } } $ data .= '--' . HttpHelper :: MIME_BOUNDARY . '--' . HttpHelper :: SEPARATOR ; $ params = [ ] ; $ url = UrlHelper :: appendParamsUrl ( Urls :: URL_BATCH , $ params ) ; $ this -> _batchResponse = $ this -> _connection -> post ( $ url , $ data ) ; if ( $ this -> _batchResponse -> getHttpCode ( ) !== 200 ) { return $ this -> _batchResponse ; } $ body = $ this -> _batchResponse -> getBody ( ) ; $ body = trim ( $ body , '--' . HttpHelper :: MIME_BOUNDARY . '--' ) ; $ batchParts = $ this -> splitWithContentIdKey ( '--' . HttpHelper :: MIME_BOUNDARY . HttpHelper :: EOL , $ body ) ; foreach ( $ batchParts as $ partKey => $ partValue ) { $ response = new HttpResponse ( $ partValue ) ; $ body = $ response -> getBody ( ) ; $ response = new HttpResponse ( $ body ) ; $ batchPartResponses [ $ partKey ] = $ response ; $ this -> getPart ( $ partKey ) -> setResponse ( $ batchPartResponses [ $ partKey ] ) ; } return $ this ; }
Processes this batch. This sends the captured requests to the server as one batch.

@return HttpResponse|Batch - Batch if processing of the batch was successful or the HttpResponse object in case of a failure. A successful process just means that tha parts were processed. Each part has it's own response though and should be checked on its own.

@throws ClientException
@throws \ArangoDBClient\Exception
Processes this batch . This sends the captured requests to the server as one batch .