Skip to content

Commit fd57c1c

Browse files
Fixed includes/class-wc-shipping-rate.php PHPCS violations
1 parent 996d3de commit fd57c1c

File tree

1 file changed

+28
-29
lines changed

1 file changed

+28
-29
lines changed

includes/class-wc-shipping-rate.php

+28-29
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
<?php
2-
3-
if ( ! defined( 'ABSPATH' ) ) {
4-
exit; // Exit if accessed directly
5-
}
6-
72
/**
8-
* WooCommerce Shipping Rate Class.
3+
* WooCommerce Shipping Rate
94
*
105
* Simple Class for storing rates.
116
*
12-
* @class WC_Shipping_Rate
13-
* @package WooCommerce/Classes/Shipping
14-
* @category Class
15-
* @author Automattic
7+
* @package WooCommerce/Classes/Shipping
8+
* @since 2.6.0
9+
*/
10+
11+
defined( 'ABSPATH' ) || exit;
12+
13+
/**
14+
* Shipping rate class.
1615
*/
1716
class WC_Shipping_Rate {
1817

@@ -42,12 +41,12 @@ class WC_Shipping_Rate {
4241
/**
4342
* Constructor.
4443
*
45-
* @param string $id
46-
* @param string $label
47-
* @param integer $cost
48-
* @param array $taxes
49-
* @param string $method_id
50-
* @param int $instance_id
44+
* @param string $id Shipping rate ID.
45+
* @param string $label Shipping rate label.
46+
* @param integer $cost Cost.
47+
* @param array $taxes Taxes applied to shipping rate.
48+
* @param string $method_id Shipping method ID.
49+
* @param int $instance_id Shipping instance ID.
5150
*/
5251
public function __construct( $id = '', $label = '', $cost = 0, $taxes = array(), $method_id = '', $instance_id = 0 ) {
5352
$this->set_id( $id );
@@ -62,7 +61,7 @@ public function __construct( $id = '', $label = '', $cost = 0, $taxes = array(),
6261
* Magic methods to support direct access to props.
6362
*
6463
* @since 3.2.0
65-
* @param string $key
64+
* @param string $key Key.
6665
* @return bool
6766
*/
6867
public function __isset( $key ) {
@@ -73,7 +72,7 @@ public function __isset( $key ) {
7372
* Magic methods to support direct access to props.
7473
*
7574
* @since 3.2.0
76-
* @param string $key
75+
* @param string $key Key.
7776
* @return mixed
7877
*/
7978
public function __get( $key ) {
@@ -90,8 +89,8 @@ public function __get( $key ) {
9089
* Magic methods to support direct access to props.
9190
*
9291
* @since 3.2.0
93-
* @param string $key
94-
* @param mixed $value
92+
* @param string $key Key.
93+
* @param mixed $value Value.
9594
*/
9695
public function __set( $key, $value ) {
9796
if ( is_callable( array( $this, "set_{$key}" ) ) ) {
@@ -105,7 +104,7 @@ public function __set( $key, $value ) {
105104
* Set ID for the rate. This is usually a combination of the method and instance IDs.
106105
*
107106
* @since 3.2.0
108-
* @param string $id
107+
* @param string $id Shipping rate ID.
109108
*/
110109
public function set_id( $id ) {
111110
$this->data['id'] = (string) $id;
@@ -115,7 +114,7 @@ public function set_id( $id ) {
115114
* Set shipping method ID the rate belongs to.
116115
*
117116
* @since 3.2.0
118-
* @param string $method_id
117+
* @param string $method_id Shipping method ID.
119118
*/
120119
public function set_method_id( $method_id ) {
121120
$this->data['method_id'] = (string) $method_id;
@@ -125,7 +124,7 @@ public function set_method_id( $method_id ) {
125124
* Set instance ID the rate belongs to.
126125
*
127126
* @since 3.2.0
128-
* @param int $instance_id
127+
* @param int $instance_id Instance ID.
129128
*/
130129
public function set_instance_id( $instance_id ) {
131130
$this->data['instance_id'] = absint( $instance_id );
@@ -135,7 +134,7 @@ public function set_instance_id( $instance_id ) {
135134
* Set rate label.
136135
*
137136
* @since 3.2.0
138-
* @param string $method_id
137+
* @param string $label Shipping rate label.
139138
*/
140139
public function set_label( $label ) {
141140
$this->data['label'] = (string) $label;
@@ -146,7 +145,7 @@ public function set_label( $label ) {
146145
*
147146
* @todo 4.0 Prevent negative value being set. #19293
148147
* @since 3.2.0
149-
* @param string $cost
148+
* @param string $cost Shipping rate cost.
150149
*/
151150
public function set_cost( $cost ) {
152151
$this->data['cost'] = $cost;
@@ -156,7 +155,7 @@ public function set_cost( $cost ) {
156155
* Set rate taxes.
157156
*
158157
* @since 3.2.0
159-
* @param array $taxes
158+
* @param array $taxes List of taxes applied to shipping rate.
160159
*/
161160
public function set_taxes( $taxes ) {
162161
$this->data['taxes'] = ! empty( $taxes ) && is_array( $taxes ) ? $taxes : array();
@@ -227,15 +226,15 @@ public function get_taxes() {
227226
* @return array
228227
*/
229228
public function get_shipping_tax() {
230-
return apply_filters( 'woocommerce_get_shipping_tax', sizeof( $this->taxes ) > 0 && ! WC()->customer->get_is_vat_exempt() ? array_sum( $this->taxes ) : 0, $this );
229+
return apply_filters( 'woocommerce_get_shipping_tax', count( $this->taxes ) > 0 && ! WC()->customer->get_is_vat_exempt() ? array_sum( $this->taxes ) : 0, $this );
231230
}
232231

233232
/**
234233
* Add some meta data for this rate.
235234
*
236235
* @since 2.6.0
237-
* @param string $key
238-
* @param string $value
236+
* @param string $key Key.
237+
* @param string $value Value.
239238
*/
240239
public function add_meta_data( $key, $value ) {
241240
$this->meta_data[ wc_clean( $key ) ] = wc_clean( $value );

0 commit comments

Comments
 (0)