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