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