@@ -161,60 +161,40 @@ public function hasCustomerPlacedAnyOrders()
161
161
return null !== $ this ->getElement ('statistics ' )->find ('css ' , '.sylius-orders-overall-count ' );
162
162
}
163
163
164
- /**
165
- * {@inheritdoc}
166
- */
167
- public function getOverallOrdersCount ()
168
- {
169
- $ overallOrders = $ this
170
- ->getElement ('statistics ' )
171
- ->find ('css ' , '.sylius-orders-overall-count ' )
172
- ->getText ()
173
- ;
174
-
175
- return (int ) preg_replace ('/[^0-9]/ ' , '' ,$ overallOrders );
176
- }
177
-
178
164
/**
179
165
* {@inheritdoc}
180
166
*/
181
167
public function getOrdersCountInChannel ($ channelName )
182
168
{
183
- $ ordersCountStatistic = $ this
169
+ return ( int ) $ this
184
170
->getStatisticsForChannel ($ channelName )
185
171
->find ('css ' , '.sylius-orders-count ' )
186
172
->getText ()
187
173
;
188
-
189
- return (int ) $ this ->getStatisticValue ($ ordersCountStatistic );
190
174
}
191
175
192
176
/**
193
177
* {@inheritdoc}
194
178
*/
195
179
public function getOrdersTotalInChannel ($ channelName )
196
180
{
197
- $ ordersCountStatistic = $ this
181
+ return $ this
198
182
->getStatisticsForChannel ($ channelName )
199
183
->find ('css ' , '.sylius-orders-total ' )
200
184
->getText ()
201
185
;
202
-
203
- return $ this ->getStatisticValue ($ ordersCountStatistic );
204
186
}
205
187
206
188
/**
207
189
* {@inheritdoc}
208
190
*/
209
191
public function getAverageTotalInChannel ($ channelName )
210
192
{
211
- $ averageTotalStatistic = $ this
193
+ return $ this
212
194
->getStatisticsForChannel ($ channelName )
213
195
->find ('css ' , '.sylius-order-average-total ' )
214
196
->getText ()
215
197
;
216
-
217
- return $ this ->getStatisticValue ($ averageTotalStatistic );
218
198
}
219
199
220
200
/**
@@ -263,7 +243,10 @@ protected function getDefinedElements()
263
243
*/
264
244
private function getStatisticsForChannel ($ channelName )
265
245
{
266
- $ statisticsRibs = $ this ->getElement ('statistics ' )->findAll ('css ' , '.accordion > .title ' );
246
+ $ statisticsRibs = $ this
247
+ ->getElement ('statistics ' )
248
+ ->findAll ('css ' , '.row > .column > .statistic > .sylius-channel-name ' )
249
+ ;
267
250
268
251
$ statisticsRibs = array_filter ($ statisticsRibs , function (NodeElement $ statistic ) use ($ channelName ) {
269
252
return $ channelName === trim ($ statistic ->getText ());
@@ -280,19 +263,9 @@ private function getStatisticsForChannel($channelName)
280
263
)
281
264
);
282
265
283
- $ statisticsContents = $ this ->getElement ('statistics ' )->findAll ('css ' , '.accordion > .content ' );
266
+ $ statisticsContents = $ this ->getElement ('statistics ' )->findAll ('css ' , '.row ' );
284
267
$ contentIndexes = array_keys ($ statisticsRibs );
285
268
286
269
return $ statisticsContents [reset ($ contentIndexes )];
287
270
}
288
-
289
- /**
290
- * @param string $statistic
291
- *
292
- * @return string
293
- */
294
- private function getStatisticValue ($ statistic )
295
- {
296
- return trim (substr ($ statistic , strpos ($ statistic , ': ' ) + 1 ));
297
- }
298
271
}
0 commit comments