✏️ 编辑:ApiCall.php
路径:
/home/forge/woocommerce-square/vendor/apimatic/core/src/ApiCall.php
大小:1.3 KB · 修改:2025-12-23 20:26:26 · 权限:0644 · 可写
← 返回目录
👁 查看
⬇ 下载
<?php declare(strict_types=1); namespace Core; use Core\Request\RequestBuilder; use Core\Response\Context; use Core\Response\ResponseHandler; class ApiCall { private $coreClient; /** * @var RequestBuilder|null */ private $requestBuilder; /** * @var ResponseHandler */ private $responseHandler; public function __construct(Client $coreClient) { $this->coreClient = $coreClient; $this->responseHandler = $coreClient->getGlobalResponseHandler(); } public function requestBuilder(RequestBuilder $requestBuilder): self { $this->requestBuilder = $requestBuilder; return $this; } public function responseHandler(ResponseHandler $responseHandler): self { $this->responseHandler = $responseHandler; return $this; } public function execute() { $request = $this->requestBuilder->build($this->coreClient); $request->addAcceptHeader($this->responseHandler->getFormat()); $this->coreClient->beforeRequest($request); $response = $this->coreClient->getHttpClient()->execute($request); $context = new Context($request, $response, $this->coreClient); $this->coreClient->afterResponse($context); return $this->responseHandler->getResult($context); } }
💾 保存
取消
保存为 UTF-8,换行统一为 LF