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