@@ -50,10 +50,10 @@ |
||
50 | 50 | $seatMap->description = $validated['description']; |
51 | 51 | $seatMap->seats = $validated['seats']; |
52 | 52 | |
53 | - if( !empty(json_decode($validated['layout'])) ) |
|
53 | + if (!empty(json_decode($validated['layout']))) |
|
54 | 54 | { |
55 | 55 | $numberOfSeatsInLayout = preg_match_all('/a/', $validated['layout']); |
56 | - if($numberOfSeatsInLayout != $validated['seats']) { |
|
56 | + if ($numberOfSeatsInLayout != $validated['seats']) { |
|
57 | 57 | return redirect() |
58 | 58 | ->route('admin.dependencies.seatmap.get', $seatMap) |
59 | 59 | ->with('status', 'Counted seats of layout (' . $numberOfSeatsInLayout . ') does not match the given seats (' . $validated['seats'] . ')!'); |
@@ -41,19 +41,19 @@ |
||
41 | 41 | |
42 | 42 | public function getRowAndSeat() |
43 | 43 | { |
44 | - if( !$this->event->seatMap->layout ) { |
|
44 | + if (!$this->event->seatMap->layout) { |
|
45 | 45 | return null; |
46 | 46 | } |
47 | 47 | |
48 | 48 | $counter = 0; |
49 | 49 | $result = []; |
50 | 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') { |
|
51 | + foreach ($rows as $rowId => $row) { |
|
52 | + foreach (str_split($row) as $charId => $char) { |
|
53 | + if ($char === 'a') { |
|
54 | 54 | $counter++; |
55 | 55 | } |
56 | - if($counter === $this->seat_number) { |
|
56 | + if ($counter === $this->seat_number) { |
|
57 | 57 | $result['row'] = $rowId; |
58 | 58 | $result['seat'] = $charId; |
59 | 59 | break; |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function passes($attribute, $value) |
37 | 37 | { |
38 | - if($value === NULL || $value === "") { |
|
38 | + if ($value === NULL || $value === "") { |
|
39 | 39 | // it is allowed for the value to be empty |
40 | 40 | return true; |
41 | 41 | } |
@@ -45,20 +45,20 @@ discard block |
||
45 | 45 | |
46 | 46 | // if json_decode result is falsy, then json object could |
47 | 47 | // not be decoded and therefore the input is invalid |
48 | - if(!$rows) { |
|
48 | + if (!$rows) { |
|
49 | 49 | return false; |
50 | 50 | } |
51 | 51 | |
52 | 52 | // iterate over all rows to check that only valid |
53 | 53 | // characters ('a' and '_') have been submitted |
54 | - foreach( $rows as $row ) { |
|
54 | + foreach ($rows as $row) { |
|
55 | 55 | // explanation for regex ^[a_]*$ |
56 | 56 | // ^ = Start of string |
57 | 57 | // [a_] = Only characters "a" and "_" allowed |
58 | 58 | // * = zero or more characters |
59 | 59 | // $ = End of string |
60 | 60 | // Complete: Only match strings that contain from start to end only zero or more characters on the whitelist of a and _ |
61 | - if( !preg_match('/^[a_]*$/', $row) ) { |
|
61 | + if (!preg_match('/^[a_]*$/', $row)) { |
|
62 | 62 | return false; |
63 | 63 | } |
64 | 64 | } |