Completed
Push — develop ( a8b3bf...1eee82 )
by Naveen
59s
created
src/wordlift/shipping-data/class-shipping-method.php 2 patches
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -8,79 +8,79 @@
 block discarded – undo
8 8
 
9 9
 class Shipping_Method {
10 10
 
11
-	/**
12
-	 * @var WC_Shipping_Method $wc_shipping_method
13
-	 */
14
-	protected $wc_shipping_method;
11
+    /**
12
+     * @var WC_Shipping_Method $wc_shipping_method
13
+     */
14
+    protected $wc_shipping_method;
15 15
 
16
-	/**
17
-	 * Shipping_Method constructor.
18
-	 *
19
-	 * @param WC_Shipping_Method $wc_shipping_method
20
-	 */
21
-	public function __construct( $wc_shipping_method ) {
22
-		$this->wc_shipping_method = $wc_shipping_method;
23
-	}
16
+    /**
17
+     * Shipping_Method constructor.
18
+     *
19
+     * @param WC_Shipping_Method $wc_shipping_method
20
+     */
21
+    public function __construct( $wc_shipping_method ) {
22
+        $this->wc_shipping_method = $wc_shipping_method;
23
+    }
24 24
 
25
-	/**
26
-	 * @param WC_Shipping_Method $wc_shipping_method
27
-	 *
28
-	 * @return Shipping_Method
29
-	 */
30
-	public static function from_wc_shipping_method( $wc_shipping_method ) {
25
+    /**
26
+     * @param WC_Shipping_Method $wc_shipping_method
27
+     *
28
+     * @return Shipping_Method
29
+     */
30
+    public static function from_wc_shipping_method( $wc_shipping_method ) {
31 31
 
32
-		switch ( get_class( $wc_shipping_method ) ) {
33
-			case 'WC_Shipping_Local_Pickup':
34
-				return new Local_Pickup_Shipping_Method( $wc_shipping_method );
32
+        switch ( get_class( $wc_shipping_method ) ) {
33
+            case 'WC_Shipping_Local_Pickup':
34
+                return new Local_Pickup_Shipping_Method( $wc_shipping_method );
35 35
 
36
-			case 'WC_Shipping_Flat_Rate':
37
-				return new Flat_Rate_Shipping_Method( $wc_shipping_method );
36
+            case 'WC_Shipping_Flat_Rate':
37
+                return new Flat_Rate_Shipping_Method( $wc_shipping_method );
38 38
 
39
-			case 'WC_Shipping_Free_Shipping':
40
-				return new Free_Shipping_Shipping_Method( $wc_shipping_method );
39
+            case 'WC_Shipping_Free_Shipping':
40
+                return new Free_Shipping_Shipping_Method( $wc_shipping_method );
41 41
 
42
-			default:
43
-				return new self( $wc_shipping_method );
44
-		}
42
+            default:
43
+                return new self( $wc_shipping_method );
44
+        }
45 45
 
46
-	}
46
+    }
47 47
 
48
-	public function add_available_delivery_method( &$jsonld ) {
48
+    public function add_available_delivery_method( &$jsonld ) {
49 49
 
50
-	}
50
+    }
51 51
 
52
-	public function add_shipping_rate( &$offer_shipping_details ) {
52
+    public function add_shipping_rate( &$offer_shipping_details ) {
53 53
 
54
-	}
54
+    }
55 55
 
56
-	public function add_transit_time( &$shipping_delivery_time ) {
56
+    public function add_transit_time( &$shipping_delivery_time ) {
57 57
 
58
-		$prefix   = "wcsdt_transit_m{$this->wc_shipping_method->get_instance_id()}";
59
-		$property = 'transitTime';
58
+        $prefix   = "wcsdt_transit_m{$this->wc_shipping_method->get_instance_id()}";
59
+        $property = 'transitTime';
60 60
 
61
-		$option = get_option( 'wpsso_options' );
61
+        $option = get_option( 'wpsso_options' );
62 62
 
63
-		if ( empty( $option["{$prefix}_unit_code"] )
64
-		     || ! is_numeric( $option["{$prefix}_minimum"] )
65
-		     || ! is_numeric( $option["{$prefix}_maximum"] ) ) {
66
-			return;
67
-		}
63
+        if ( empty( $option["{$prefix}_unit_code"] )
64
+             || ! is_numeric( $option["{$prefix}_minimum"] )
65
+             || ! is_numeric( $option["{$prefix}_maximum"] ) ) {
66
+            return;
67
+        }
68 68
 
69
-		$unit_code = $option["{$prefix}_unit_code"];
70
-		$minimum   = $option["{$prefix}_minimum"];
71
-		$maximum   = $option["{$prefix}_maximum"];
69
+        $unit_code = $option["{$prefix}_unit_code"];
70
+        $minimum   = $option["{$prefix}_minimum"];
71
+        $maximum   = $option["{$prefix}_maximum"];
72 72
 
73
-		if ( 'HUR' === $unit_code ) {
74
-			$minimum = floor( $minimum / 24.0 );
75
-			$maximum = ceil( $maximum / 24.0 );
76
-		}
73
+        if ( 'HUR' === $unit_code ) {
74
+            $minimum = floor( $minimum / 24.0 );
75
+            $maximum = ceil( $maximum / 24.0 );
76
+        }
77 77
 
78
-		$shipping_delivery_time[ $property ] = array(
79
-			'@type'    => 'QuantitativeValue',
80
-			'minValue' => intval( $minimum ),
81
-			'maxValue' => intval( $maximum ),
82
-		);
78
+        $shipping_delivery_time[ $property ] = array(
79
+            '@type'    => 'QuantitativeValue',
80
+            'minValue' => intval( $minimum ),
81
+            'maxValue' => intval( $maximum ),
82
+        );
83 83
 
84
-	}
84
+    }
85 85
 
86 86
 }
87 87
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 *
19 19
 	 * @param WC_Shipping_Method $wc_shipping_method
20 20
 	 */
21
-	public function __construct( $wc_shipping_method ) {
21
+	public function __construct($wc_shipping_method) {
22 22
 		$this->wc_shipping_method = $wc_shipping_method;
23 23
 	}
24 24
 
@@ -27,42 +27,42 @@  discard block
 block discarded – undo
27 27
 	 *
28 28
 	 * @return Shipping_Method
29 29
 	 */
30
-	public static function from_wc_shipping_method( $wc_shipping_method ) {
30
+	public static function from_wc_shipping_method($wc_shipping_method) {
31 31
 
32
-		switch ( get_class( $wc_shipping_method ) ) {
32
+		switch (get_class($wc_shipping_method)) {
33 33
 			case 'WC_Shipping_Local_Pickup':
34
-				return new Local_Pickup_Shipping_Method( $wc_shipping_method );
34
+				return new Local_Pickup_Shipping_Method($wc_shipping_method);
35 35
 
36 36
 			case 'WC_Shipping_Flat_Rate':
37
-				return new Flat_Rate_Shipping_Method( $wc_shipping_method );
37
+				return new Flat_Rate_Shipping_Method($wc_shipping_method);
38 38
 
39 39
 			case 'WC_Shipping_Free_Shipping':
40
-				return new Free_Shipping_Shipping_Method( $wc_shipping_method );
40
+				return new Free_Shipping_Shipping_Method($wc_shipping_method);
41 41
 
42 42
 			default:
43
-				return new self( $wc_shipping_method );
43
+				return new self($wc_shipping_method);
44 44
 		}
45 45
 
46 46
 	}
47 47
 
48
-	public function add_available_delivery_method( &$jsonld ) {
48
+	public function add_available_delivery_method(&$jsonld) {
49 49
 
50 50
 	}
51 51
 
52
-	public function add_shipping_rate( &$offer_shipping_details ) {
52
+	public function add_shipping_rate(&$offer_shipping_details) {
53 53
 
54 54
 	}
55 55
 
56
-	public function add_transit_time( &$shipping_delivery_time ) {
56
+	public function add_transit_time(&$shipping_delivery_time) {
57 57
 
58 58
 		$prefix   = "wcsdt_transit_m{$this->wc_shipping_method->get_instance_id()}";
59 59
 		$property = 'transitTime';
60 60
 
61
-		$option = get_option( 'wpsso_options' );
61
+		$option = get_option('wpsso_options');
62 62
 
63
-		if ( empty( $option["{$prefix}_unit_code"] )
64
-		     || ! is_numeric( $option["{$prefix}_minimum"] )
65
-		     || ! is_numeric( $option["{$prefix}_maximum"] ) ) {
63
+		if (empty($option["{$prefix}_unit_code"])
64
+		     || ! is_numeric($option["{$prefix}_minimum"])
65
+		     || ! is_numeric($option["{$prefix}_maximum"])) {
66 66
 			return;
67 67
 		}
68 68
 
@@ -70,15 +70,15 @@  discard block
 block discarded – undo
70 70
 		$minimum   = $option["{$prefix}_minimum"];
71 71
 		$maximum   = $option["{$prefix}_maximum"];
72 72
 
73
-		if ( 'HUR' === $unit_code ) {
74
-			$minimum = floor( $minimum / 24.0 );
75
-			$maximum = ceil( $maximum / 24.0 );
73
+		if ('HUR' === $unit_code) {
74
+			$minimum = floor($minimum / 24.0);
75
+			$maximum = ceil($maximum / 24.0);
76 76
 		}
77 77
 
78
-		$shipping_delivery_time[ $property ] = array(
78
+		$shipping_delivery_time[$property] = array(
79 79
 			'@type'    => 'QuantitativeValue',
80
-			'minValue' => intval( $minimum ),
81
-			'maxValue' => intval( $maximum ),
80
+			'minValue' => intval($minimum),
81
+			'maxValue' => intval($maximum),
82 82
 		);
83 83
 
84 84
 	}
Please login to merge, or discard this patch.