PluginProbe ʕ •ᴥ•ʔ
WooCommerce Square / 4.5.2
WooCommerce Square v4.5.2
5.4.1 5.4.0 trunk 1.0.25 1.0.26 1.0.27 1.0.28 1.0.29 1.0.30 1.0.31 1.0.32 1.0.33 1.0.34 1.0.35 1.0.36 1.0.37 1.0.38 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.4.0 2.4.1 2.5.0 2.5.1 2.5.2 2.5.3 2.6.0 2.7.0 2.8.0 2.9.0 2.9.1 3.0.0 3.0.1 3.0.2 3.0.3 3.1.0 3.2.0 3.3.0 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.6.1 3.7.0 3.7.1 3.8.0 3.8.1 3.8.2 3.8.3 3.9.0 4.0.0 4.1.0 4.2.0 4.2.1 4.2.2 4.2.3 4.3.0 4.3.1 4.3.2 4.4.0 4.4.1 4.4.2 4.5.0 4.5.1 4.5.2 4.6.0 4.6.1 4.6.2 4.6.3 4.6.4 4.7.0 4.7.1 4.7.2 4.7.3 4.7.4 4.8.0 4.8.1 4.8.2 4.8.3 4.8.4 4.8.5 4.8.6 4.8.7 4.8.8 4.9.0 4.9.1 4.9.2 4.9.3 4.9.4 4.9.5 4.9.6 4.9.7 4.9.8 4.9.9 5.0.0 5.0.1 5.1.0 5.1.1 5.1.2 5.2.0 5.3.0 5.3.1 5.3.2 5.3.3
woocommerce-square / includes / API / Request.php
woocommerce-square / includes / API Last commit date
Requests 3 years ago Responses 3 years ago Request.php 3 years ago Response.php 3 years ago
Request.php
204 lines
1 <?php
2 /**
3 * WooCommerce Square
4 *
5 * This source file is subject to the GNU General Public License v3.0
6 * that is bundled with this package in the file license.txt.
7 * It is also available through the world-wide-web at this URL:
8 * http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0 or later
9 * If you did not receive a copy of the license and are unable to
10 * obtain it through the world-wide-web, please send an email
11 * to license@woocommerce.com so we can send you a copy immediately.
12 *
13 * DISCLAIMER
14 *
15 * Do not edit or add to this file if you wish to upgrade WooCommerce Square to newer
16 * versions in the future. If you wish to customize WooCommerce Square for your
17 * needs please refer to https://docs.woocommerce.com/document/woocommerce-square/
18 *
19 * @author WooCommerce
20 * @copyright Copyright: (c) 2019, Automattic, Inc.
21 * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0 or later
22 */
23
24 namespace WooCommerce\Square\API;
25
26 use SquareConnect\Configuration;
27 use \WooCommerce\Square\Framework\Api\API_Request;
28
29 defined( 'ABSPATH' ) || exit;
30
31 /**
32 * Base WooCommerce Square API request object.
33 *
34 * @since 2.0.0
35 */
36 class Request implements API_Request {
37
38
39 /** @var Configuration the configuration object */
40 protected $configuration;
41
42 /** @var mixed the Square API class instance being used for this request */
43 protected $square_api;
44
45 /** @var string method name on the square API to call */
46 protected $square_api_method;
47
48 /** @var array arguments for the method call */
49 protected $square_api_args = array();
50
51 /** @var null|object the square API request model */
52 protected $square_request;
53
54 /** @var bool whether the request is being made 'WithHTTPInfo' or not */
55 protected $with_http_info = true;
56
57
58 /**
59 * Gets the Square API instance to use for this request.
60 *
61 * @since 2.0.0
62 *
63 * @return mixed
64 */
65 public function get_square_api() {
66
67 return $this->square_api;
68 }
69
70
71 /**
72 * Get the method to call on the Square API instance.
73 *
74 * @since 2.0.0
75 *
76 * @return string
77 */
78 public function get_square_api_method() {
79 return $this->square_api_method;
80 }
81
82
83 /**
84 * Gets the arguments to call the Square API method with.
85 *
86 * @since 2.0.0
87 *
88 * @return array
89 */
90 public function get_square_api_args() {
91
92 return $this->square_api_args;
93 }
94
95
96 /**
97 * Returns whether this request is set to get HTTP info.
98 *
99 * @since 2.0.0
100 *
101 * @return bool
102 */
103 public function get_with_http_info() {
104
105 return $this->with_http_info;
106 }
107
108
109 /**
110 * Gets the HTTP method.
111 *
112 * @since 2.0.0
113 *
114 * @return string
115 */
116 public function get_method() {
117 // TODO: Implement get_method() method.
118 }
119
120
121 /**
122 * Gets the query parameters.
123 *
124 * @since 2.0.0
125 *
126 * @return array
127 */
128 public function get_params() {
129 // TODO: Implement get_params() method.
130 }
131
132
133 /**
134 * Gets the path.
135 *
136 * @since 2.0.0
137 *
138 * @return string
139 */
140 public function get_path() {
141 // TODO: Implement get_path() method.
142 }
143
144
145 /**
146 * Gets the request data.
147 *
148 * @since 2.0.0
149 *
150 * @return array
151 */
152 public function get_data() {
153 // TODO: Implement get_data() method.
154 }
155
156
157 /**
158 * Gets the request data as a string.
159 *
160 * @since 2.0.0
161 *
162 * @return string
163 */
164 public function to_string() {
165
166 $body = '';
167
168 if ( is_callable( array( $this->square_request, '__toString' ) ) ) {
169
170 $body = $this->square_request->__toString();
171
172 } elseif ( is_array( $this->square_api_args ) ) {
173
174 $body = array();
175
176 foreach ( $this->square_api_args as $key => $arg ) {
177
178 if ( is_callable( array( $arg, '__toString' ) ) ) {
179 $body[ $key ] = $arg->__toString();
180 }
181 }
182
183 $body = implode( ',', $body );
184 }
185
186 return $body;
187 }
188
189
190 /**
191 * Gets the request data as a string with all sensitive information masked.
192 *
193 * @since 2.0.0
194 *
195 * @return string
196 */
197 public function to_string_safe() {
198
199 return $this->to_string();
200 }
201
202
203 }
204