public function append($method, $request)
    {
        preg_match('%/_api/simple/(?P<simple>\w*)|/_api/(?P<direct>\w*)%ix', $request, $regs);

        if (!isset($regs['direct'])) {
            $regs['direct'] = '';
        }
        $type = $regs['direct'] !== '' ? $regs['direct'] : $regs['simple'];

        if ($method === 'GET' && $type === $regs['direct']) {
            $type = 'get' . $type;
        }

        if (null === $this->_nextBatchPartId) {
            if (is_a($this->_batchParts, \SplFixedArray::class)) {
                $nextNumeric = $this->_nextId;
                $this->_nextId++;
            } else {
                $nextNumeric = count($this->_batchParts);
            }
            $batchPartId = $nextNumeric;
        } else {
            $batchPartId            = $this->_nextBatchPartId;
            $this->_nextBatchPartId = null;
        }

        $eol = HttpHelper::EOL;

        $result = 'HTTP/1.1 202 Accepted' . $eol;
        $result .= 'location: /_db/_system/_api/document/0/0' . $eol;
        $result .= 'content-type: application/json; charset=utf-8' . $eol;
        $result .= 'etag: "0"' . $eol;
        $result .= 'connection: Close' . $eol . $eol;
        $result .= '{"error":false,"_id":"0/0","id":"0","_rev":0,"hasMore":1, "result":[{}], "documents":[{}]}' . $eol . $eol;

        $response  = new HttpResponse($result);
        $batchPart = new BatchPart($this, $batchPartId, $type, $request, $response, [
            'cursorOptions'  => $this->_batchPartCursorOptions,
            '_documentClass' => $this->_documentClass,
        ]);

        $this->_batchParts[$batchPartId] = $batchPart;

        $response->setBatchPart($batchPart);

        return $response;
    }
public function append($method, $request)
    {
        preg_match('%/_api/simple/(?P<simple>\w*)|/_api/(?P<direct>\w*)%ix', $request, $regs);

        if (!isset($regs['direct'])) {
            $regs['direct'] = '';
        }
        $type = $regs['direct'] !== '' ? $regs['direct'] : $regs['simple'];

        if ($method === 'GET' && $type === $regs['direct']) {
            $type = 'get' . $type;
        }

        if (null === $this->_nextBatchPartId) {
            if (is_a($this->_batchParts, \SplFixedArray::class)) {
                $nextNumeric = $this->_nextId;
                $this->_nextId++;
            } else {
                $nextNumeric = count($this->_batchParts);
            }
            $batchPartId = $nextNumeric;
        } else {
            $batchPartId            = $this->_nextBatchPartId;
            $this->_nextBatchPartId = null;
        }

        $eol = HttpHelper::EOL;

        $result = 'HTTP/1.1 202 Accepted' . $eol;
        $result .= 'location: /_db/_system/_api/document/0/0' . $eol;
        $result .= 'content-type: application/json; charset=utf-8' . $eol;
        $result .= 'etag: "0"' . $eol;
        $result .= 'connection: Close' . $eol . $eol;
        $result .= '{"error":false,"_id":"0/0","id":"0","_rev":0,"hasMore":1, "result":[{}], "documents":[{}]}' . $eol . $eol;

        $response  = new HttpResponse($result);
        $batchPart = new BatchPart($this, $batchPartId, $type, $request, $response, [
            'cursorOptions'  => $this->_batchPartCursorOptions,
            '_documentClass' => $this->_documentClass,
        ]);

        $this->_batchParts[$batchPartId] = $batchPart;

        $response->setBatchPart($batchPart);

        return $response;
    }
public function append ( $ method , $ request ) { preg_match ( '%/_api/simple/(?P<simple>\w*)|/_api/(?P<direct>\w*)%ix' , $ request , $ regs ) ; if ( ! isset ( $ regs [ 'direct' ] ) ) { $ regs [ 'direct' ] = '' ; } $ type = $ regs [ 'direct' ] !== '' ? $ regs [ 'direct' ] : $ regs [ 'simple' ] ; if ( $ method === 'GET' && $ type === $ regs [ 'direct' ] ) { $ type = 'get' . $ type ; } if ( null === $ this -> _nextBatchPartId ) { if ( is_a ( $ this -> _batchParts , \ SplFixedArray :: class ) ) { $ nextNumeric = $ this -> _nextId ; $ this -> _nextId ++ ; } else { $ nextNumeric = count ( $ this -> _batchParts ) ; } $ batchPartId = $ nextNumeric ; } else { $ batchPartId = $ this -> _nextBatchPartId ; $ this -> _nextBatchPartId = null ; } $ eol = HttpHelper :: EOL ; $ result = 'HTTP/1.1 202 Accepted' . $ eol ; $ result .= 'location: /_db/_system/_api/document/0/0' . $ eol ; $ result .= 'content-type: application/json; charset=utf-8' . $ eol ; $ result .= 'etag: "0"' . $ eol ; $ result .= 'connection: Close' . $ eol . $ eol ; $ result .= '{"error":false,"_id":"0/0","id":"0","_rev":0,"hasMore":1, "result":[{}], "documents":[{}]}' . $ eol . $ eol ; $ response = new HttpResponse ( $ result ) ; $ batchPart = new BatchPart ( $ this , $ batchPartId , $ type , $ request , $ response , [ 'cursorOptions' => $ this -> _batchPartCursorOptions , '_documentClass' => $ this -> _documentClass , ] ) ; $ this -> _batchParts [ $ batchPartId ] = $ batchPart ; $ response -> setBatchPart ( $ batchPart ) ; return $ response ; }
Append the request to the batch-part

@param mixed $method  - The method of the request (GET, POST...)
@param mixed $request - The request that will get appended to the batch

@return HttpResponse

@throws \ArangoDBClient\ClientException
Append the request to the batch - part