@@ -92,29 +92,6 @@ public function selectShippingMethod(array $shipping)
92
92
}
93
93
}
94
94
95
- /**
96
- * Compare elements according to $this->estimationFields order
97
- *
98
- * @param $a
99
- * @param $b
100
- * @return int
101
- */
102
- public function compare ($ a , $ b )
103
- {
104
- $ a = array_search ($ a , $ this ->estimationFields );
105
- $ b = array_search ($ b , $ this ->estimationFields );
106
- switch (true ) {
107
- case false !== $ a && false !== $ b :
108
- return $ a - $ b ;
109
- case false !== $ a :
110
- return -1 ;
111
- case false !== $ b :
112
- return 1 ;
113
- default :
114
- return 0 ;
115
- }
116
- }
117
-
118
95
/**
119
96
* Fill shipping and tax form.
120
97
*
@@ -126,8 +103,21 @@ public function fillEstimateShippingAndTax(Address $address)
126
103
$ this ->openEstimateShippingAndTax ();
127
104
$ data = $ address ->getData ();
128
105
$ mapping = $ this ->dataMapping (array_intersect_key ($ data , array_flip ($ this ->estimationFields )));
129
- // sort array according to $this->estimationFields element order
130
- uksort ($ mapping , [$ this , 'compare ' ]);
106
+ // sort array according to $this->estimationFields elements order
107
+ uksort ($ mapping , function ($ a , $ b ) {
108
+ $ a = array_search ($ a , $ this ->estimationFields );
109
+ $ b = array_search ($ b , $ this ->estimationFields );
110
+ switch (true ) {
111
+ case false !== $ a && false !== $ b :
112
+ return $ a - $ b ;
113
+ case false !== $ a :
114
+ return -1 ;
115
+ case false !== $ b :
116
+ return 1 ;
117
+ default :
118
+ return 0 ;
119
+ }
120
+ });
131
121
132
122
// Test environment may become unstable when form fields are filled in a default manner.
133
123
// Imitating behavior closer to the real user.
0 commit comments