| Conditions | 4 |
| Paths | 4 |
| Total Lines | 15 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 55 | public static function treeify(array $tiles) |
||
| 56 | { |
||
| 57 | $target = []; |
||
| 58 | foreach ($tiles as $tile) { |
||
| 59 | $position = $tile->getPosition(); |
||
| 60 | $cursor = &$target; |
||
| 61 | foreach ([$position->getFace(), $position->getY()] as $segment) { |
||
| 62 | if (!isset($cursor[$segment])) { |
||
| 63 | $cursor[$segment] = []; |
||
| 64 | } |
||
| 65 | $cursor = &$cursor[$segment]; |
||
| 66 | } |
||
| 67 | $cursor[$position->getX()] = $tile; |
||
| 68 | } |
||
| 69 | return $target; |
||
| 70 | } |
||
| 72 |