PluginProbe ʕ •ᴥ•ʔ
WooCommerce Square / 5.3.0
WooCommerce Square v5.3.0
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 months ago Responses 3 years ago Request.php 1 year ago Response.php 3 years ago
Request.php
198 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 public function get_method() {
115 // TODO: Implement get_method() method.
116 }
117
118
119 /**
120 * Gets the query parameters.
121 *
122 * @since 2.0.0
123 */
124 public function get_params() {
125 // TODO: Implement get_params() method.
126 }
127
128
129 /**
130 * Gets the path.
131 *
132 * @since 2.0.0
133 */
134 public function get_path() {
135 // TODO: Implement get_path() method.
136 }
137
138
139 /**
140 * Gets the request data.
141 *
142 * @since 2.0.0
143 */
144 public function get_data() {
145 // TODO: Implement get_data() method.
146 }
147
148
149 /**
150 * Gets the request data as a string.
151 *
152 * @since 2.0.0
153 *
154 * @return string
155 */
156 public function to_string() {
157
158 $body = '';
159
160 if ( is_callable( array( $this->square_request, '__toString' ) ) ) {
161
162 $body = $this->square_request->__toString();
163
164 } elseif ( is_array( $this->square_api_args ) ) {
165
166 $body = array();
167
168 foreach ( $this->square_api_args as $key => $arg ) {
169
170 if ( is_callable( array( $arg, '__toString' ) ) ) {
171 $body[ $key ] = $arg->__toString();
172 } elseif ( $arg instanceof \JsonSerializable ) {
173 $body[ $key ] = wp_json_encode( $arg );
174 }
175 }
176
177 $body = implode( ',', $body );
178 }
179
180 return $body;
181 }
182
183
184 /**
185 * Gets the request data as a string with all sensitive information masked.
186 *
187 * @since 2.0.0
188 *
189 * @return string
190 */
191 public function to_string_safe() {
192
193 return $this->to_string();
194 }
195
196
197 }
198