@@ 366-370 (lines=5) @@ | ||
363 | $rel = $match[2]; |
|
364 | ||
365 | $matched = preg_match('/page=(\d+)/U', $url, $pageMatches); |
|
366 | if (!$matched || count($pageMatches)!=2) { |
|
367 | throw new Exception('Error extracting page argument while parsing LINK header: ' . |
|
368 | $parsedHeaders['link'], Exception::CODE_API_ERROR, |
|
369 | array('http_code'=>$httpCode)); |
|
370 | } |
|
371 | ||
372 | $pageNumber = $pageMatches[1]; |
|
373 | ||
@@ 378-384 (lines=7) @@ | ||
375 | $result->setPrevPage($pageNumber); |
|
376 | } else if ($rel=='next') { |
|
377 | $result->setNextPage($pageNumber); |
|
378 | } else if ($rel=='last') { |
|
379 | $result->setLastPage($pageNumber); |
|
380 | } else { |
|
381 | throw new Exception('Unexpected rel argument while parsing LINK header: ' . |
|
382 | $parsedHeaders['link'], Exception::CODE_API_ERROR, |
|
383 | array('http_code'=>$httpCode)); |
|
384 | } |
|
385 | } |
|
386 | } |
|
387 |