AccessToken
5 days ago
AuthHandler
5 days ago
Http
5 days ago
Service
5 days ago
Task
5 days ago
Utils
5 days ago
Client.php
5 days ago
Collection.php
5 days ago
Exception.php
5 days ago
Model.php
5 days ago
Service.php
5 days ago
aliases.php
5 days ago
Service.php
68 lines
| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | * Copyright 2010 Google Inc. |
| 5 | * |
| 6 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | * you may not use this file except in compliance with the License. |
| 8 | * You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, software |
| 13 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | * See the License for the specific language governing permissions and |
| 16 | * limitations under the License. |
| 17 | */ |
| 18 | namespace WPMailSMTP\Vendor\Google; |
| 19 | |
| 20 | use WPMailSMTP\Vendor\Google\Http\Batch; |
| 21 | use TypeError; |
| 22 | class Service |
| 23 | { |
| 24 | public $batchPath; |
| 25 | /** |
| 26 | * Only used in getBatch |
| 27 | */ |
| 28 | public $rootUrl; |
| 29 | public $rootUrlTemplate; |
| 30 | public $version; |
| 31 | public $servicePath; |
| 32 | public $serviceName; |
| 33 | public $availableScopes; |
| 34 | public $resource; |
| 35 | private $client; |
| 36 | public function __construct($clientOrConfig = []) |
| 37 | { |
| 38 | if ($clientOrConfig instanceof Client) { |
| 39 | $this->client = $clientOrConfig; |
| 40 | } elseif (\is_array($clientOrConfig)) { |
| 41 | $this->client = new Client($clientOrConfig ?: []); |
| 42 | } else { |
| 43 | $errorMessage = 'WPMailSMTP\\Vendor\\constructor must be array or instance of Google\\Client'; |
| 44 | if (\class_exists('TypeError')) { |
| 45 | throw new TypeError($errorMessage); |
| 46 | } |
| 47 | \trigger_error($errorMessage, \E_USER_ERROR); |
| 48 | } |
| 49 | } |
| 50 | /** |
| 51 | * Return the associated Google\Client class. |
| 52 | * @return \Google\Client |
| 53 | */ |
| 54 | public function getClient() |
| 55 | { |
| 56 | return $this->client; |
| 57 | } |
| 58 | /** |
| 59 | * Create a new HTTP Batch handler for this service |
| 60 | * |
| 61 | * @return Batch |
| 62 | */ |
| 63 | public function createBatch() |
| 64 | { |
| 65 | return new Batch($this->client, \false, $this->rootUrlTemplate ?? $this->rootUrl, $this->batchPath); |
| 66 | } |
| 67 | } |
| 68 |