PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13
1.8.13.1 1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 All 212 releases
charitable / vendor / square / square / src / Legacy / Apis / BaseApi.php

BaseApi.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.13, at vendor/square/square/src/Legacy/Apis/BaseApi.php

47 lines 993 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Square\Legacy\Apis;
6
7 use Core\ApiCall;
8 use Core\Client;
9 use Core\Request\RequestBuilder;
10 use Core\Response\ResponseHandler;
11
12 /**
13 * Base controller
14 */
15 class BaseApi
16 {
17 /**
18 * Client instance
19 *
20 * @var Client
21 */
22 private $client;
23
24 public function __construct(Client $client)
25 {
26 $this->client = $client;
27 }
28
29 protected function execute(RequestBuilder $requestBuilder, ?ResponseHandler $responseHandler = null)
30 {
31 return (new ApiCall($this->client))
32 ->requestBuilder($requestBuilder)
33 ->responseHandler($responseHandler ?? $this->responseHandler())
34 ->execute();
35 }
36
37 protected function requestBuilder(string $requestMethod, string $path): RequestBuilder
38 {
39 return new RequestBuilder($requestMethod, $path);
40 }
41
42 protected function responseHandler(): ResponseHandler
43 {
44 return $this->client->getGlobalResponseHandler();
45 }
46 }
47