From 13dfb560bc74fa5ea18ee3ff04e3e69f8a97f74e Mon Sep 17 00:00:00 2001 From: Jayvin Date: Mon, 28 Dec 2015 19:44:41 +0400 Subject: [PATCH] Update shopify.php Formatted, removed spaces and tabs. Not yet tested. Code can be more cleaner by just checking "$this->token == null" and removing property $isPrivateApp --- shopify.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/shopify.php b/shopify.php index df87d4f..068eaa9 100644 --- a/shopify.php +++ b/shopify.php @@ -13,9 +13,7 @@ public function __construct($shop_domain, $token, $api_key, $secret) { $this->token = $token; $this->api_key = $api_key; $this->secret = $secret; - if($this->token == null){ - $this->isPrivateApp = true; - } + $this->isPrivateApp = $this->token == null; } // Get the URL required to request authorization @@ -64,11 +62,10 @@ public function call($method, $path, $params=array()) $payload = in_array($method, array('POST','PUT')) ? json_encode($params) : array(); $request_headers = in_array($method, array('POST','PUT')) ? array("Content-Type: application/json; charset=utf-8", 'Expect:') : array(); - if(!$this->isPrivateApp) - { - // add auth headers for public app + if(!$this->isPrivateApp){ + // add auth headers for public app $request_headers[] = 'X-Shopify-Access-Token: ' . $this->token; - } + } $response = $this->curlHttpApiRequest($method, $url, $query, $payload, $request_headers); $response = json_decode($response, true);