Skip to content

Commit cddb678

Browse files
authored
Move createService to AbstractApi (#41)
1 parent 500adc8 commit cddb678

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

src/AbstractApi.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use GuzzleHttp\Client;
66
use Psr\Log\LoggerInterface;
7+
use Shopify\Service\AbstractService;
78

89
abstract class AbstractApi implements ApiInterface
910
{
@@ -146,6 +147,17 @@ public function getApiVersion()
146147
return $this->api_version;
147148
}
148149

150+
/**
151+
* Helper function to create new service instances
152+
*
153+
* @param $serviceClass Fully Qualified Service className
154+
* @return AbstractService
155+
*/
156+
public function createService($serviceClass)
157+
{
158+
return new $serviceClass($this);
159+
}
160+
149161
/**
150162
* Initialize our Client, using settings based on the app type
151163
*

src/Api.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22

33
namespace Shopify;
44

5-
use Shopify\Service\AbstractService;
65
use Shopify\Storage\PersistentStorageInterface;
76
use Shopify\Storage\SessionStorage;
87
use Shopify\Helper\OAuthHelper;
98
use GuzzleHttp\Client;
10-
use Psr\Log\LoggerInterface;
119

1210
class Api extends AbstractApi
1311
{
@@ -146,17 +144,6 @@ public function getOAuthHelper()
146144
return new OAuthHelper($this, $this->getStorageInterface());
147145
}
148146

149-
/**
150-
* Helper function to create new service instances
151-
*
152-
* @param $serviceClass Fully Qualified Service className
153-
* @return AbstractService
154-
*/
155-
public function createService($serviceClass)
156-
{
157-
return new $serviceClass($this);
158-
}
159-
160147
public function loadApiKeyFromEnv()
161148
{
162149
$this->api_key = getenv(self::SHOPIFY_API_KEY_NAME);

0 commit comments

Comments
 (0)