@@ -147,7 +147,7 @@ class ShopifySDK
147
147
*
148
148
* @var array
149
149
*/
150
- public static $ config = array ();
150
+ public $ config = array ();
151
151
152
152
/**
153
153
* List of available resources which can be called from this client
@@ -223,8 +223,8 @@ class ShopifySDK
223
223
public function __construct ($ config = array ())
224
224
{
225
225
if (!empty ($ config )) {
226
- ShopifySDK:: $ config = $ config ;
227
- ShopifySDK:: setAdminUrl ();
226
+ $ this -> config = $ config ;
227
+ $ this -> setAdminUrl ();
228
228
}
229
229
}
230
230
@@ -271,7 +271,7 @@ public function __call($resourceName, $arguments)
271
271
$ resourceID = !empty ($ arguments ) ? $ arguments [0 ] : null ;
272
272
273
273
//Initiate the resource object
274
- $ resource = new $ resourceClassName ($ resourceID );
274
+ $ resource = new $ resourceClassName ( $ this -> config , $ resourceID );
275
275
276
276
return $ resource ;
277
277
}
@@ -283,15 +283,15 @@ public function __call($resourceName, $arguments)
283
283
*
284
284
* @return ShopifySDK
285
285
*/
286
- public static function config ($ config )
286
+ public function config ($ config )
287
287
{
288
288
foreach ($ config as $ key => $ value ) {
289
- self :: $ config [$ key ] = $ value ;
289
+ $ this -> config [$ key ] = $ value ;
290
290
}
291
291
292
292
//Re-set the admin url if shop url is changed
293
293
if (isset ($ config ['ShopUrl ' ])) {
294
- self :: setAdminUrl ();
294
+ $ this -> setAdminUrl ();
295
295
}
296
296
297
297
//If want to keep more wait time than .5 seconds for each call
@@ -307,22 +307,22 @@ public static function config($config)
307
307
*
308
308
* @return string
309
309
*/
310
- public static function setAdminUrl ()
310
+ public function setAdminUrl ()
311
311
{
312
- $ shopUrl = self :: $ config ['ShopUrl ' ];
312
+ $ shopUrl = $ this -> config ['ShopUrl ' ];
313
313
314
314
//Remove https:// and trailing slash (if provided)
315
315
$ shopUrl = preg_replace ('#^https?://|/$# ' , '' , $ shopUrl );
316
316
317
- if (isset (self :: $ config ['ApiKey ' ]) && isset (self :: $ config ['Password ' ])) {
318
- $ apiKey = self :: $ config ['ApiKey ' ];
319
- $ apiPassword = self :: $ config ['Password ' ];
317
+ if (isset ($ this -> config ['ApiKey ' ]) && isset ($ this -> config ['Password ' ])) {
318
+ $ apiKey = $ this -> config ['ApiKey ' ];
319
+ $ apiPassword = $ this -> config ['Password ' ];
320
320
$ adminUrl = "https:// $ apiKey: $ apiPassword@ $ shopUrl/admin/ " ;
321
321
} else {
322
322
$ adminUrl = "https:// $ shopUrl/admin/ " ;
323
323
}
324
324
325
- self :: $ config ['AdminUrl ' ] = $ adminUrl ;
325
+ $ this -> config ['AdminUrl ' ] = $ adminUrl ;
326
326
327
327
return $ adminUrl ;
328
328
}
@@ -332,8 +332,8 @@ public static function setAdminUrl()
332
332
*
333
333
* @return string
334
334
*/
335
- public static function getAdminUrl () {
336
- return self :: $ config ['AdminUrl ' ];
335
+ public function getAdminUrl () {
336
+ return $ this -> config ['AdminUrl ' ];
337
337
}
338
338
339
339
/**
0 commit comments