Passed
Push — master ( 87d5fa...1b8ab4 )
by Brian
07:29 queued 14s
created
includes/payments/class-getpaid-form-item.php 1 patch
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if (!defined('ABSPATH')) {
3 3
 	exit;
4 4
 }
5 5
 
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
 	 * @param  string $context View or edit context.
95 95
 	 * @return string
96 96
 	 */
97
-	public function get_name( $context = 'view' ) {
98
-		$name = parent::get_name( $context );
99
-		return $name . wpinv_get_item_suffix( $this );
97
+	public function get_name($context = 'view') {
98
+		$name = parent::get_name($context);
99
+		return $name . wpinv_get_item_suffix($this);
100 100
 	}
101 101
 
102 102
 	/**
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
 	 * @param  string $context View or edit context.
107 107
 	 * @return string
108 108
 	 */
109
-	public function get_raw_name( $context = 'view' ) {
110
-		return parent::get_name( $context );
109
+	public function get_raw_name($context = 'view') {
110
+		return parent::get_name($context);
111 111
 	}
112 112
 
113 113
 	/**
@@ -117,13 +117,13 @@  discard block
 block discarded – undo
117 117
 	 * @param  string $context View or edit context.
118 118
 	 * @return string
119 119
 	 */
120
-	public function get_description( $context = 'view' ) {
120
+	public function get_description($context = 'view') {
121 121
 
122
-		if ( isset( $this->custom_description ) ) {
122
+		if (isset($this->custom_description)) {
123 123
 			return $this->custom_description;
124 124
 		}
125 125
 
126
-		return parent::get_description( $context );
126
+		return parent::get_description($context);
127 127
 	}
128 128
 
129 129
 	/**
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
 	 * @param  string $context View or edit context.
134 134
 	 * @return float
135 135
 	 */
136
-	public function get_sub_total( $context = 'view' ) {
137
-		return $this->get_quantity( $context ) * $this->get_initial_price( $context );
136
+	public function get_sub_total($context = 'view') {
137
+		return $this->get_quantity($context) * $this->get_initial_price($context);
138 138
 	}
139 139
 
140 140
 	/**
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
 	 * @param  string $context View or edit context.
145 145
 	 * @return float
146 146
 	 */
147
-	public function get_recurring_sub_total( $context = 'view' ) {
147
+	public function get_recurring_sub_total($context = 'view') {
148 148
 
149
-		if ( $this->is_recurring() ) {
150
-			return $this->get_quantity( $context ) * $this->get_price( $context );
149
+		if ($this->is_recurring()) {
150
+			return $this->get_quantity($context) * $this->get_price($context);
151 151
 		}
152 152
 
153 153
 		return 0;
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
 	/**
157 157
 	 * @deprecated
158 158
 	 */
159
-	public function get_qantity( $context = 'view' ) {
160
-		return $this->get_quantity( $context );
159
+	public function get_qantity($context = 'view') {
160
+		return $this->get_quantity($context);
161 161
 	}
162 162
 
163 163
 	/**
@@ -167,11 +167,11 @@  discard block
 block discarded – undo
167 167
 	 * @param  string $context View or edit context.
168 168
 	 * @return float
169 169
 	 */
170
-	public function get_quantity( $context = 'view' ) {
170
+	public function get_quantity($context = 'view') {
171 171
 		$quantity = (float) $this->quantity;
172 172
 
173
-		if ( 'view' == $context ) {
174
-			return apply_filters( 'getpaid_payment_form_item_quantity', $quantity, $this );
173
+		if ('view' == $context) {
174
+			return apply_filters('getpaid_payment_form_item_quantity', $quantity, $this);
175 175
 		}
176 176
 
177 177
 		return $quantity;
@@ -185,11 +185,11 @@  discard block
 block discarded – undo
185 185
 	 * @param  string $context View or edit context.
186 186
 	 * @return meta
187 187
 	 */
188
-	public function get_item_meta( $context = 'view' ) {
188
+	public function get_item_meta($context = 'view') {
189 189
 		$meta = $this->meta;
190 190
 
191
-		if ( 'view' == $context ) {
192
-			return apply_filters( 'getpaid_payment_form_item_meta', $meta, $this );
191
+		if ('view' == $context) {
192
+			return apply_filters('getpaid_payment_form_item_meta', $meta, $this);
193 193
 		}
194 194
 
195 195
 		return $meta;
@@ -203,11 +203,11 @@  discard block
 block discarded – undo
203 203
 	 * @param  string $context View or edit context.
204 204
 	 * @return bool
205 205
 	 */
206
-	public function get_allow_quantities( $context = 'view' ) {
206
+	public function get_allow_quantities($context = 'view') {
207 207
 		$allow_quantities = (bool) $this->allow_quantities;
208 208
 
209
-		if ( 'view' == $context ) {
210
-			return apply_filters( 'getpaid_payment_form_item_allow_quantities', $allow_quantities, $this );
209
+		if ('view' == $context) {
210
+			return apply_filters('getpaid_payment_form_item_allow_quantities', $allow_quantities, $this);
211 211
 		}
212 212
 
213 213
 		return $allow_quantities;
@@ -221,11 +221,11 @@  discard block
 block discarded – undo
221 221
 	 * @param  string $context View or edit context.
222 222
 	 * @return bool
223 223
 	 */
224
-	public function get_is_required( $context = 'view' ) {
224
+	public function get_is_required($context = 'view') {
225 225
 		$is_required = (bool) $this->is_required;
226 226
 
227
-		if ( 'view' == $context ) {
228
-			return apply_filters( 'getpaid_payment_form_item_is_required', $is_required, $this );
227
+		if ('view' == $context) {
228
+			return apply_filters('getpaid_payment_form_item_is_required', $is_required, $this);
229 229
 		}
230 230
 
231 231
 		return $is_required;
@@ -238,11 +238,11 @@  discard block
 block discarded – undo
238 238
 	 * @since 1.0.19
239 239
 	 * @return array
240 240
 	 */
241
-	public function prepare_data_for_use( $required = null ) {
241
+	public function prepare_data_for_use($required = null) {
242 242
 
243
-		$required = is_null( $required ) ? $this->is_required() : $required;
243
+		$required = is_null($required) ? $this->is_required() : $required;
244 244
 		return array(
245
-			'title'            => strip_tags( $this->get_name() ),
245
+			'title'            => strip_tags($this->get_name()),
246 246
 			'id'               => $this->get_id(),
247 247
 			'price'            => $this->get_price(),
248 248
 			'recurring'        => $this->is_recurring(),
@@ -259,30 +259,30 @@  discard block
 block discarded – undo
259 259
 	 * @since 1.0.19
260 260
 	 * @return array
261 261
 	 */
262
-	public function prepare_data_for_invoice_edit_ajax( $currency = '', $is_renewal = false ) {
262
+	public function prepare_data_for_invoice_edit_ajax($currency = '', $is_renewal = false) {
263 263
 
264
-		$description = getpaid_item_recurring_price_help_text( $this, $currency );
264
+		$description = getpaid_item_recurring_price_help_text($this, $currency);
265 265
 
266
-		if ( $description ) {
266
+		if ($description) {
267 267
 			$description = "<div class='getpaid-subscription-help-text'>$description</div>";
268 268
 		}
269 269
 
270
-		$price    = ! $is_renewal ? $this->get_price() : $this->get_recurring_price();
271
-		$subtotal = ! $is_renewal ? $this->get_sub_total() : $this->get_recurring_sub_total();
270
+		$price    = !$is_renewal ? $this->get_price() : $this->get_recurring_price();
271
+		$subtotal = !$is_renewal ? $this->get_sub_total() : $this->get_recurring_sub_total();
272 272
 		return array(
273 273
 			'id'     => $this->get_id(),
274 274
 			'texts'  => array(
275
-				'item-name'        => sanitize_text_field( $this->get_name() ),
276
-				'item-description' => wp_kses_post( $this->get_description() ) . $description,
277
-				'item-quantity'    => floatval( $this->get_quantity() ),
278
-				'item-price'       => wpinv_price( $price, $currency ),
279
-				'item-total'       => wpinv_price( $subtotal, $currency ),
275
+				'item-name'        => sanitize_text_field($this->get_name()),
276
+				'item-description' => wp_kses_post($this->get_description()) . $description,
277
+				'item-quantity'    => floatval($this->get_quantity()),
278
+				'item-price'       => wpinv_price($price, $currency),
279
+				'item-total'       => wpinv_price($subtotal, $currency),
280 280
 			),
281 281
 			'inputs' => array(
282 282
 				'item-id'          => $this->get_id(),
283
-				'item-name'        => sanitize_text_field( $this->get_name() ),
284
-				'item-description' => wp_kses_post( $this->get_description() ),
285
-				'item-quantity'    => floatval( $this->get_quantity() ),
283
+				'item-name'        => sanitize_text_field($this->get_name()),
284
+				'item-description' => wp_kses_post($this->get_description()),
285
+				'item-quantity'    => floatval($this->get_quantity()),
286 286
 				'item-price'       => $price,
287 287
 			)
288 288
 		);
@@ -300,15 +300,15 @@  discard block
 block discarded – undo
300 300
 		return array(
301 301
 			'post_id'           => $this->invoice_id,
302 302
 			'item_id'           => $this->get_id(),
303
-			'item_name'         => sanitize_text_field( $this->get_raw_name( 'edit' ) ),
304
-			'item_description'  => $this->get_description( 'edit' ),
303
+			'item_name'         => sanitize_text_field($this->get_raw_name('edit')),
304
+			'item_description'  => $this->get_description('edit'),
305 305
 			'tax'               => $this->item_tax,
306
-			'item_price'        => $this->get_price( 'edit' ),
307
-			'quantity'          => (float) $this->get_quantity( 'edit' ),
306
+			'item_price'        => $this->get_price('edit'),
307
+			'quantity'          => (float) $this->get_quantity('edit'),
308 308
 			'discount'          => $this->item_discount,
309
-			'subtotal'          => $this->get_sub_total( 'edit' ),
310
-			'price'             => $this->get_sub_total( 'edit' ) + $this->item_tax - $this->item_discount,
311
-			'meta'              => $this->get_item_meta( 'edit' ),
309
+			'subtotal'          => $this->get_sub_total('edit'),
310
+			'price'             => $this->get_sub_total('edit') + $this->item_tax - $this->item_discount,
311
+			'meta'              => $this->get_item_meta('edit'),
312 312
 		);
313 313
 
314 314
 	}
@@ -329,9 +329,9 @@  discard block
 block discarded – undo
329 329
 	 * @since 1.0.19
330 330
 	 * @param  float $quantity The item quantity.
331 331
 	 */
332
-	public function set_quantity( $quantity ) {
332
+	public function set_quantity($quantity) {
333 333
 
334
-		if ( ! is_numeric( $quantity ) ) {
334
+		if (!is_numeric($quantity)) {
335 335
 			$quantity = 1;
336 336
 		}
337 337
 
@@ -345,8 +345,8 @@  discard block
 block discarded – undo
345 345
 	 * @since 1.0.19
346 346
 	 * @param  array $meta The item meta data.
347 347
 	 */
348
-	public function set_item_meta( $meta ) {
349
-		$this->meta = maybe_unserialize( $meta );
348
+	public function set_item_meta($meta) {
349
+		$this->meta = maybe_unserialize($meta);
350 350
 	}
351 351
 
352 352
 	/**
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 	 * @since 1.0.19
356 356
 	 * @param  bool $allow_quantities
357 357
 	 */
358
-	public function set_allow_quantities( $allow_quantities ) {
358
+	public function set_allow_quantities($allow_quantities) {
359 359
 		$this->allow_quantities = (bool) $allow_quantities;
360 360
 	}
361 361
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 	 * @since 1.0.19
366 366
 	 * @param  bool $is_required
367 367
 	 */
368
-	public function set_is_required( $is_required ) {
368
+	public function set_is_required($is_required) {
369 369
 		$this->is_required = (bool) $is_required;
370 370
 	}
371 371
 
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 	 * @since 1.0.19
376 376
 	 * @param  string $description
377 377
 	 */
378
-	public function set_custom_description( $description ) {
378
+	public function set_custom_description($description) {
379 379
 		$this->custom_description = $description;
380 380
 	}
381 381
 
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
      * 
385 385
 	 * @return int item id
386 386
      */
387
-    public function save( $data = array() ) {
387
+    public function save($data = array()) {
388 388
         return $this->get_id();
389 389
 	}
390 390
 
Please login to merge, or discard this patch.