@@ -21,7 +21,9 @@ |
||
| 21 | 21 | $cols = explode("\t", $row); |
| 22 | 22 | $ret_row = []; |
| 23 | 23 | $cnt = count($cols); |
| 24 | - if ($cnt > $x) $x = $cnt; |
|
| 24 | + if ($cnt > $x) { |
|
| 25 | + $x = $cnt; |
|
| 26 | + } |
|
| 25 | 27 | foreach ($cols as $col) { |
| 26 | 28 | $ret_row[] = $col; |
| 27 | 29 | } |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | */ |
| 40 | 40 | public function getColumnsMaxLenght($columnIndex) |
| 41 | 41 | { |
| 42 | - if(isset($this->columnsMaxLenght[$columnIndex])) return $this->columnsMaxLenght[$columnIndex]; |
|
| 42 | + if (isset($this->columnsMaxLenght[$columnIndex])) return $this->columnsMaxLenght[$columnIndex]; |
|
| 43 | 43 | $width = 0; |
| 44 | 44 | for ($y = 0; $y < $this->dimensionY; $y++) { |
| 45 | 45 | $len = strlen($this->getCell($columnIndex, $y)); |
@@ -39,11 +39,15 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public function getColumnsMaxLenght($columnIndex) |
| 41 | 41 | { |
| 42 | - if(isset($this->columnsMaxLenght[$columnIndex])) return $this->columnsMaxLenght[$columnIndex]; |
|
| 42 | + if(isset($this->columnsMaxLenght[$columnIndex])) { |
|
| 43 | + return $this->columnsMaxLenght[$columnIndex]; |
|
| 44 | + } |
|
| 43 | 45 | $width = 0; |
| 44 | 46 | for ($y = 0; $y < $this->dimensionY; $y++) { |
| 45 | 47 | $len = strlen($this->getCell($columnIndex, $y)); |
| 46 | - if ($len > $width) $width = $len; |
|
| 48 | + if ($len > $width) { |
|
| 49 | + $width = $len; |
|
| 50 | + } |
|
| 47 | 51 | } |
| 48 | 52 | |
| 49 | 53 | $this->columnsMaxLenght[$columnIndex] = $width; |
@@ -64,7 +68,9 @@ discard block |
||
| 64 | 68 | |
| 65 | 69 | foreach ($this->data as $row) { |
| 66 | 70 | $cnt = count($row); |
| 67 | - if ($cnt > $this->dimensionX) $this->dimensionX = $cnt; |
|
| 71 | + if ($cnt > $this->dimensionX) { |
|
| 72 | + $this->dimensionX = $cnt; |
|
| 73 | + } |
|
| 68 | 74 | } |
| 69 | 75 | $this->dimensionY = count($this->data); |
| 70 | 76 | } |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | $this->metadata[$key] = $value; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public function format(Table $table, $firstRowAsHeader = true){ |
|
| 23 | + public function format(Table $table, $firstRowAsHeader = true) { |
|
| 24 | 24 | $this->table = $table; |
| 25 | 25 | $str = ""; |
| 26 | 26 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - for ($i = $firsRow; $i < $this->table->getDimensionY(); $i++){ |
|
| 43 | + for ($i = $firsRow; $i < $this->table->getDimensionY(); $i++) { |
|
| 44 | 44 | $str .= $this->line($i); |
| 45 | 45 | } |
| 46 | 46 | |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | private function line($rowIndex) { |
| 63 | 63 | $retStr = ""; |
| 64 | 64 | $delimiter = $this->metadata["BL"]; |
| 65 | - for ($i = 0; $i < $this->table->getDimensionX(); $i++){ |
|
| 65 | + for ($i = 0; $i < $this->table->getDimensionX(); $i++) { |
|
| 66 | 66 | $retStr .= $delimiter; |
| 67 | 67 | $cell = $this->table->getCell($i, $rowIndex); |
| 68 | 68 | $retStr .= " " . $cell . str_repeat(" ", $this->table->getColumnsMaxLenght($i) - strlen($cell)) . " "; |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | // Second row |
| 91 | 91 | $delimiter = $this->metadata["BL"]; |
| 92 | - for ($i = 0; $i < $this->table->getDimensionX(); $i++){ |
|
| 92 | + for ($i = 0; $i < $this->table->getDimensionX(); $i++) { |
|
| 93 | 93 | $retStr .= $delimiter; |
| 94 | 94 | $retStr .= " " . $this->table->getCell($i, 0) . " "; |
| 95 | 95 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | // Third row |
| 99 | 99 | $delimiter = $this->metadata["H2BL"]; |
| 100 | - for ($i = 0; $i < $this->table->getDimensionX(); $i++){ |
|
| 100 | + for ($i = 0; $i < $this->table->getDimensionX(); $i++) { |
|
| 101 | 101 | $columnLenght = $this->table->getColumnsMaxLenght($i) + 2; |
| 102 | 102 | $retStr .= $delimiter; |
| 103 | 103 | $retStr .= str_repeat($this->metadata["BPAD"], $columnLenght); |