diff --git a/src/Http/Controllers/WebhookController.php b/src/Http/Controllers/WebhookController.php index b53d437..959e245 100644 --- a/src/Http/Controllers/WebhookController.php +++ b/src/Http/Controllers/WebhookController.php @@ -47,6 +47,6 @@ protected function buildWebhook(Request $request) protected function getEventName(Webhook $webhook) { - return 'laravel-shopify-webhook.' . str_replace('/', '-', $webhook->topic()); + return 'laravel-shopify-webhook.'.str_replace('/', '-', $webhook->topic()); } } diff --git a/src/Providers/DefaultHandlerStackProvider.php b/src/Providers/DefaultHandlerStackProvider.php index e2f5585..d663a35 100644 --- a/src/Providers/DefaultHandlerStackProvider.php +++ b/src/Providers/DefaultHandlerStackProvider.php @@ -13,6 +13,7 @@ public function getHandlerStack() : HandlerStack { $handlerStack = HandlerStack::create(); $handlerStack->push(new RateLimiter($this->getRateLimitProvider())); + return $handlerStack; } diff --git a/src/Providers/DefaultRateLimitProvider.php b/src/Providers/DefaultRateLimitProvider.php index 85214d1..0ea334f 100644 --- a/src/Providers/DefaultRateLimitProvider.php +++ b/src/Providers/DefaultRateLimitProvider.php @@ -26,7 +26,7 @@ public function __construct(RateLimitCalculatorContract $calculator, string $pre */ public function getLastRequestTime() { - return Cache::get($this->prefix . 'last_request_time'); + return Cache::get($this->prefix.'last_request_time'); } /** @@ -35,7 +35,7 @@ public function getLastRequestTime() */ public function setLastRequestTime() { - return Cache::forever($this->prefix . 'last_request_time', microtime(true)); + return Cache::forever($this->prefix.'last_request_time', microtime(true)); } /** @@ -65,7 +65,7 @@ public function getRequestTime(RequestInterface $request) */ public function getRequestAllowance(RequestInterface $request) { - return Cache::get($this->prefix . 'request_allowance', config('shopify.rate_limit.cycle')); + return Cache::get($this->prefix.'request_allowance', config('shopify.rate_limit.cycle')); } /** @@ -76,7 +76,7 @@ public function getRequestAllowance(RequestInterface $request) */ public function setRequestAllowance(ResponseInterface $response) { - Cache::forever($this->prefix . 'request_allowance', $this->calculateAllowanceFrom($response)); + Cache::forever($this->prefix.'request_allowance', $this->calculateAllowanceFrom($response)); } /** @@ -93,6 +93,7 @@ protected function calculateAllowanceFrom(ResponseInterface $response) if ($callLimitHeader) { [$callsMade, $callsLimit] = explode('/', $callLimitHeader); + return $this->calculator->calculate($callsMade, $callsLimit); } diff --git a/src/ShopifyServiceProvider.php b/src/ShopifyServiceProvider.php index ba05766..7397de0 100644 --- a/src/ShopifyServiceProvider.php +++ b/src/ShopifyServiceProvider.php @@ -19,7 +19,7 @@ public function boot() { $this->setupConfig($this->app); - /** + /* * @todo Perhaps allow for options allowing a user to modify aspects of the route...? */ Route::macro('shopifyWebhooks', function () { diff --git a/tests/ExampleTest.php b/tests/ExampleTest.php index 8fce5f0..6be6eab 100644 --- a/tests/ExampleTest.php +++ b/tests/ExampleTest.php @@ -7,7 +7,7 @@ class ExampleTest extends TestCase { /** @test */ - function it_reaches_the_shopify_api() + public function it_reaches_the_shopify_api() { $shopify = $this->app->make(Shopify::class);