PluginProbe ʕ •ᴥ•ʔ
GSheetConnector For Ninja Forms / trunk
GSheetConnector For Ninja Forms vtrunk
1.2.19 1.2.20 1.2.21 1.2.22 1.2.23 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0.0 2.0.1 2.0.2 trunk 1.1 1.2 1.2.1 1.2.10 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18
gsheetconnector-ninja-forms / lib / src / Service.php
gsheetconnector-ninja-forms / lib / src Last commit date
AccessToken 2 years ago AuthHandler 2 years ago Http 2 years ago Service 2 years ago Task 2 years ago Utils 2 years ago Client.php 2 years ago Collection.php 2 years ago Exception.php 2 years ago Model.php 2 years ago Service.php 2 years ago aliases.php 2 years ago autoload.php 2 years ago
Service.php
73 lines
1 <?php
2 /*
3 * Copyright 2010 Google Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18 namespace Google;
19
20 use Google\Http\Batch;
21 use TypeError;
22
23 class Service
24 {
25 public $batchPath;
26 public $rootUrl;
27 public $version;
28 public $servicePath;
29 public $serviceName;
30 public $availableScopes;
31 public $resource;
32 private $client;
33
34 public function __construct($clientOrConfig = [])
35 {
36 if ($clientOrConfig instanceof Client) {
37 $this->client = $clientOrConfig;
38 } elseif (is_array($clientOrConfig)) {
39 $this->client = new Client($clientOrConfig ?: []);
40 } else {
41 $errorMessage = 'constructor must be array or instance of Google\Client';
42 if (class_exists('TypeError')) {
43 throw new TypeError($errorMessage);
44 }
45 trigger_error($errorMessage, E_USER_ERROR);
46 }
47 }
48
49 /**
50 * Return the associated Google\Client class.
51 * @return \Google\Client
52 */
53 public function getClient()
54 {
55 return $this->client;
56 }
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(
66 $this->client,
67 false,
68 $this->rootUrl,
69 $this->batchPath
70 );
71 }
72 }
73