Skip to content

Commit 84c4a4f

Browse files
committed
Headers are coming as array, no need json_decode
1 parent b6deb67 commit 84c4a4f

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

lib/ShopifyResource.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -555,16 +555,15 @@ public function getLinks($responseHeaders){
555555
}
556556

557557
public function getLink($responseHeaders, $type='next'){
558-
$responseHeaders = json_decode($responseHeaders);
559558

560-
if(property_exists($responseHeaders,'x-shopify-api-version')
561-
&& $responseHeaders->{'x-shopify-api-version'} < '2019-07'){
559+
if(array_key_exists('x-shopify-api-version', $responseHeaders)
560+
&& $responseHeaders['x-shopify-api-version'] < '2019-07'){
562561
return null;
563562
}
564563

565-
if(!empty($responseHeaders->link)) {
566-
if (stristr($responseHeaders->link[0], '; rel="'.$type.'"') > -1) {
567-
$headerLinks = explode(',', $responseHeaders->link[0]);
564+
if(!empty($responseHeaders['link'])) {
565+
if (stristr($responseHeaders['link'][0], '; rel="'.$type.'"') > -1) {
566+
$headerLinks = explode(',', $responseHeaders['link'][0]);
568567
foreach ($headerLinks as $headerLink) {
569568
if (stristr($headerLink, '; rel="'.$type.'"') === -1) {
570569
continue;

0 commit comments

Comments
 (0)