| Conditions | 3 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | public function getRowsAndColumns() |
||
| 17 | { |
||
| 18 | if(!$this->layout) { |
||
| 19 | return null; |
||
| 20 | } |
||
| 21 | |||
| 22 | $result = []; |
||
| 23 | |||
| 24 | $rows = json_decode($this->layout); |
||
| 25 | $result['rows'] = count($rows); |
||
| 26 | $result['columns'] = array_reduce($rows, function($intermediate, $row) { |
||
| 27 | $columns = strlen($row); |
||
| 28 | if($intermediate < $columns) { |
||
| 29 | return $columns; |
||
| 30 | } else { |
||
| 31 | return $intermediate; |
||
| 32 | } |
||
| 33 | }, 0); |
||
| 34 | return $result; |
||
| 35 | } |
||
| 37 |