@@ -562,8 +562,9 @@ public function getLink($responseHeaders, $type='next'){
562562 }
563563
564564 if (!empty ($ responseHeaders ['link ' ])) {
565- if (stristr ($ responseHeaders ['link ' ][0 ], '; rel=" ' .$ type .'" ' ) > -1 ) {
566- $ headerLinks = explode (', ' , $ responseHeaders ['link ' ][0 ]);
565+ var_dump ($ responseHeaders ['link ' ]);
566+ if (stristr ($ responseHeaders ['link ' ], '; rel=" ' .$ type .'" ' ) > -1 ) {
567+ $ headerLinks = explode (', ' , $ responseHeaders ['link ' ]);
567568 foreach ($ headerLinks as $ headerLink ) {
568569 if (stristr ($ headerLink , '; rel=" ' .$ type .'" ' ) === -1 ) {
569570 continue ;
@@ -589,15 +590,25 @@ public function getNextLink(){
589590 return $ this ->nextLink ;
590591 }
591592
593+ public function getUrlParams ($ url ) {
594+ if ($ url ) {
595+ $ parts = parse_url ($ url );
596+ return $ parts ['query ' ];
597+ }
598+ return '' ;
599+ }
600+
592601 public function getNextPageParams (){
593602 $ nextPageParams = [];
594- parse_str ($ this ->getNextLink (), $ nextPageParams );
603+ $ nextPageLink =
604+
605+ parse_str ($ this ->getUrlParams ($ this ->getNextLink ()), $ nextPageParams );
595606 return $ nextPageParams ;
596607 }
597608
598609 public function getPrevPageParams (){
599610 $ nextPageParams = [];
600- parse_str ($ this ->getPrevLink (), $ nextPageParams );
611+ parse_str ($ this ->getUrlParams ( $ this -> getPrevLink () ), $ nextPageParams );
601612 return $ nextPageParams ;
602613 }
603614}
0 commit comments