| Conditions | 4 |
| Paths | 2 |
| Total Lines | 18 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 4.0058 |
| Changes | 0 | ||
| 1 | <?php |
||
| 59 | 21 | protected function sort() |
|
| 60 | { |
||
| 61 | 21 | if (!$this->isSorted) { |
|
| 62 | 20 | uasort( |
|
| 63 | 20 | $this->list, |
|
| 64 | 11 | function (Box $boxA, Box $boxB) { |
|
| 65 | 11 | if ($boxB->getInnerVolume() > $boxA->getInnerVolume()) { |
|
| 66 | 4 | return -1; |
|
| 67 | 10 | } elseif ($boxB->getInnerVolume() < $boxA->getInnerVolume()) { |
|
| 68 | 10 | return 1; |
|
| 69 | } else { |
||
| 70 | return 0; |
||
| 71 | } |
||
| 72 | } |
||
| 73 | 20 | ); |
|
| 74 | 20 | $this->isSorted = true; |
|
| 75 | 20 | } |
|
| 76 | 21 | } |
|
| 77 | } |
||
| 78 |