Conditions | 6 |
Paths | 7 |
Total Lines | 22 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
42 | public function getRowAndSeat() |
||
43 | { |
||
44 | if( !$this->event->seatMap->layout ) { |
||
45 | return null; |
||
46 | } |
||
47 | |||
48 | $counter = 0; |
||
49 | $result = []; |
||
50 | $rows = json_decode($this->event->seatMap->layout); |
||
51 | foreach( $rows as $rowId => $row ) { |
||
52 | foreach( str_split($row) as $charId => $char) { |
||
53 | if($char === 'a') { |
||
54 | $counter++; |
||
55 | } |
||
56 | if($counter === $this->seat_number) { |
||
57 | $result['row'] = $rowId; |
||
58 | $result['seat'] = $charId; |
||
59 | break; |
||
60 | } |
||
61 | } |
||
62 | } |
||
63 | return $result; |
||
64 | } |
||
66 |