public function withSession(string $shop, string $accessToken, Closure $closure)
    {
        // Clone the API class and bind it to the closure
        $clonedApi = clone $this;
        $clonedApi->setSession($shop, $accessToken);

        return $closure->call($clonedApi);
    }
public function withSession(string $shop, string $accessToken, Closure $closure)
    {
        // Clone the API class and bind it to the closure
        $clonedApi = clone $this;
        $clonedApi->setSession($shop, $accessToken);

        return $closure->call($clonedApi);
    }
public function withSession ( string $ shop , string $ accessToken , Closure $ closure ) { // Clone the API class and bind it to the closure $ clonedApi = clone $ this ; $ clonedApi -> setSession ( $ shop , $ accessToken ) ; return $ closure -> call ( $ clonedApi ) ; }
Accepts a closure to do isolated API calls for a shop.

@param string  $shop        The shop's domain
@param string  $accessToken The access token for API requests
@param Closure $closure     The closure to run isolated

@throws \Exception When closure is missing or not callable

@return self
Accepts a closure to do isolated API calls for a shop .