Conditions | 5 |
Paths | 3 |
Total Lines | 22 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
22 | public function getEstimates() |
||
23 | { |
||
24 | if ($this->calculated) { |
||
25 | return $this->estimates; |
||
26 | } |
||
27 | $output = new ArrayList(); |
||
28 | if ($options = $this->getShippingMethods()) { |
||
29 | foreach ($options as $option) { |
||
30 | $rate = $option->getCalculator($this->order)->calculate($this->address); |
||
31 | if ($rate !== null) { |
||
32 | $option->CalculatedRate = $rate; |
||
33 | $output->push($option); |
||
34 | } |
||
35 | } |
||
36 | } |
||
37 | $output->sort("CalculatedRate", "ASC"); //sort by rate, lowest to highest |
||
38 | // cache estimates |
||
39 | $this->estimates = $output; |
||
40 | $this->calculated = true; |
||
41 | |||
42 | return $output; |
||
43 | } |
||
44 | |||
54 |