Conditions | 6 |
Paths | 7 |
Total Lines | 25 |
Code Lines | 17 |
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 | $columnCounter = 0; |
||
|
|||
50 | $result = []; |
||
51 | $rows = json_decode($this->event->seatMap->layout); |
||
52 | foreach( $rows as $rowId => $row ) { |
||
53 | $columnCounter = 0; |
||
54 | foreach( str_split($row) as $charId => $char) { |
||
55 | if($char === 'a') { |
||
56 | $counter++; |
||
57 | $columnCounter++; |
||
58 | } |
||
59 | if($counter === $this->seat_number) { |
||
60 | $result['row'] = $rowId+1; |
||
61 | $result['seat'] = $columnCounter; |
||
62 | break; |
||
63 | } |
||
64 | } |
||
65 | } |
||
66 | return $result; |
||
67 | } |
||
69 |