Skip to content

Commit 6d2dfb4

Browse files
committed
PSR-2 Compliance
1 parent 8ca30ce commit 6d2dfb4

File tree

6 files changed

+30
-22
lines changed

6 files changed

+30
-22
lines changed

lib/CurlRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ protected static function init($url, $httpHeaders = array())
4848
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
4949

5050
$headers = array();
51-
foreach($httpHeaders as $key => $value) {
51+
foreach ($httpHeaders as $key => $value) {
5252
$headers[] = "$key: $value";
5353
}
5454
//Set HTTP Headers

lib/GiftCard.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ class GiftCard extends ShopifyAPI
3939
*
4040
* @return array
4141
*/
42-
public function disable() {
42+
public function disable()
43+
{
4344
$url = $this->generateUrl(array(), 'disable');
4445

4546
$dataArray = array(

lib/RecurringApplicationCharge.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ class RecurringApplicationCharge extends ShopifyAPI
6565
* @return array
6666
*
6767
*/
68-
public function customize($dataArray) {
68+
public function customize($dataArray)
69+
{
6970
$dataArray = $this->wrapData($dataArray);
7071

7172
$url = $this->generateUrl($dataArray, 'customize');

lib/ShopifyAPI.php

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,10 @@ public function __call($name, $arguments)
194194
//Get the array key for the action in the actions array
195195
foreach ($actionMaps as $httpMethod => $actionArrayKey) {
196196
$actionKey = array_search($name, $this->$actionArrayKey);
197-
if($actionKey !== false) break;
197+
if ($actionKey !== false) break;
198198
}
199199

200-
if($actionKey === false) {
200+
if ($actionKey === false) {
201201
throw new SdkException("No action named $name is defined for " . $this->getResourceName());
202202
}
203203

@@ -233,7 +233,8 @@ public function __call($name, $arguments)
233233
*
234234
* @return string
235235
*/
236-
public function getResourceName() {
236+
public function getResourceName()
237+
{
237238
return substr(get_called_class(), strrpos(get_called_class(), '\\') + 1);
238239
}
239240

@@ -243,7 +244,8 @@ public function getResourceName() {
243244
*
244245
* @return string
245246
*/
246-
public function getResourcePostKey() {
247+
public function getResourcePostKey()
248+
{
247249
return $this->resourceKey;
248250
}
249251

@@ -253,7 +255,8 @@ public function getResourcePostKey() {
253255
*
254256
* @return string
255257
*/
256-
protected function pluralizeKey() {
258+
protected function pluralizeKey()
259+
{
257260
return $this->resourceKey . 's';
258261
}
259262

@@ -264,7 +267,8 @@ protected function pluralizeKey() {
264267
*
265268
* @return string
266269
*/
267-
protected function getResourcePath() {
270+
protected function getResourcePath()
271+
{
268272
return $this->pluralizeKey();
269273
}
270274

@@ -294,7 +298,7 @@ public function generateUrl($urlParams = array(), $customAction = null)
294298
public function get($urlParams = array(), $url = null)
295299
{
296300

297-
if (! $url) $url = $this->generateUrl($urlParams);
301+
if (!$url) $url = $this->generateUrl($urlParams);
298302

299303
$this->prepareRequest();
300304

@@ -319,7 +323,7 @@ public function get($urlParams = array(), $url = null)
319323
public function getCount($urlParams = array(), $url = null)
320324
{
321325

322-
if (! $url) $url = $this->generateUrl($urlParams, 'count');
326+
if (!$url) $url = $this->generateUrl($urlParams, 'count');
323327

324328
$this->prepareRequest();
325329

@@ -339,11 +343,11 @@ public function getCount($urlParams = array(), $url = null)
339343
*/
340344
public function search($query)
341345
{
342-
if(!$this->searchEnabled) {
346+
if (!$this->searchEnabled) {
343347
throw new SdkException("Search is not available for " . $this->getResourceName());
344348
}
345349

346-
if (! is_array($query)) $query = array('query' => $query);
350+
if (!is_array($query)) $query = array('query' => $query);
347351

348352
$url = $this->generateUrl($query, 'search');
349353

@@ -362,7 +366,7 @@ public function search($query)
362366
*/
363367
public function post($dataArray, $url = null)
364368
{
365-
if (! $url) $url = $this->generateUrl();
369+
if (!$url) $url = $this->generateUrl();
366370

367371
$this->prepareRequest($dataArray);
368372

@@ -384,7 +388,7 @@ public function post($dataArray, $url = null)
384388
public function put($dataArray, $url = null)
385389
{
386390

387-
if (! $url) $url = $this->generateUrl();
391+
if (!$url) $url = $this->generateUrl();
388392

389393
$this->prepareRequest($dataArray);
390394

@@ -405,7 +409,7 @@ public function put($dataArray, $url = null)
405409
*/
406410
public function delete($urlParams = array(), $url = null)
407411
{
408-
if (! $url) $url = $this->generateUrl($urlParams);
412+
if (!$url) $url = $this->generateUrl($urlParams);
409413

410414
$this->prepareRequest();
411415

@@ -448,8 +452,9 @@ public function prepareRequest($dataArray = array())
448452
*
449453
* @return array
450454
*/
451-
protected function wrapData($dataArray, $dataKey = null) {
452-
if (! $dataKey) $dataKey = $this->getResourcePostKey();
455+
protected function wrapData($dataArray, $dataKey = null)
456+
{
457+
if (!$dataKey) $dataKey = $this->getResourcePostKey();
453458

454459
return array($dataKey => $dataArray);
455460
}
@@ -507,7 +512,7 @@ public function processResponse($response, $dataKey = false)
507512
}
508513
}
509514

510-
if (isset ($responseArray['errors'])) {
515+
if (isset($responseArray['errors'])) {
511516
$message = $this->castString($responseArray['errors']);
512517

513518
throw new ApiException($message);

lib/ShopifyClient.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ public function __construct($config)
8686
//Remove https:// and trailing slash (if provided)
8787
$config['ShopUrl'] = preg_replace('#^https?://|/$#', '',$config['ShopUrl']);
8888

89-
if(isset($config['ApiKey']) && isset($config['Password'])) {
89+
if (isset($config['ApiKey']) && isset($config['Password'])) {
9090
$apiKey = $config['ApiKey'];
9191
$password = $config['Password'];
9292

9393
$config['ApiUrl'] = "https://$apiKey:$password@" . $config['ShopUrl'] . '/admin/';
94-
} elseif(!isset($config['AccessToken'])) {
94+
} elseif (!isset($config['AccessToken'])) {
9595
throw new SdkException("Either AccessToken or ApiKey+Password Combination must be provided!");
9696
} else {
9797
$config['ApiUrl'] = 'https://' . $config['ShopUrl'] . '/admin/';

lib/SmartCollection.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ class SmartCollection extends ShopifyAPI
5151
*
5252
* @return array
5353
*/
54-
public function sortOrder($params) {
54+
public function sortOrder($params)
55+
{
5556
$url = $this->generateUrl($params, 'order');
5657

5758
return $this->put(array(), $url);

0 commit comments

Comments
 (0)