| 1 |
<?php |
| 2 |
|
| 3 |
namespace TablePress\PhpOffice\PhpSpreadsheet\Worksheet; |
| 4 |
|
| 5 |
use TablePress\PhpOffice\PhpSpreadsheet\Calculation\Functions; |
| 6 |
use TablePress\PhpOffice\PhpSpreadsheet\Cell\CellAddress; |
| 7 |
use TablePress\PhpOffice\PhpSpreadsheet\Cell\Coordinate; |
| 8 |
|
| 9 |
class PageBreak |
| 10 |
{ |
| 11 |
private int $breakType; |
| 12 |
|
| 13 |
private string $coordinate; |
| 14 |
|
| 15 |
private int $maxColOrRow; |
| 16 |
|
| 17 |
/** |
| 18 |
* @param array{0: int, 1: int}|CellAddress|string $coordinate |
| 19 |
*/ |
| 20 |
public function __construct(int $breakType, $coordinate, int $maxColOrRow = -1) |
| 21 |
{ |
| 22 |
$coordinate = Functions::trimSheetFromCellReference(Validations::validateCellAddress($coordinate)); |
| 23 |
$this->breakType = $breakType; |
| 24 |
$this->coordinate = $coordinate; |
| 25 |
$this->maxColOrRow = $maxColOrRow; |
| 26 |
} |
| 27 |
|
| 28 |
public function getBreakType(): int |
| 29 |
{ |
| 30 |
return $this->breakType; |
| 31 |
} |
| 32 |
|
| 33 |
public function getCoordinate(): string |
| 34 |
{ |
| 35 |
return $this->coordinate; |
| 36 |
} |
| 37 |
|
| 38 |
public function getMaxColOrRow(): int |
| 39 |
{ |
| 40 |
return $this->maxColOrRow; |
| 41 |
} |
| 42 |
|
| 43 |
public function getColumnInt(): int |
| 44 |
{ |
| 45 |
return Coordinate::indexesFromString($this->coordinate)[0]; |
| 46 |
} |
| 47 |
|
| 48 |
public function getRow(): int |
| 49 |
{ |
| 50 |
return Coordinate::indexesFromString($this->coordinate)[1]; |
| 51 |
} |
| 52 |
|
| 53 |
public function getColumnString(): string |
| 54 |
{ |
| 55 |
return Coordinate::indexesFromString($this->coordinate)[2]; |
| 56 |
} |
| 57 |
} |
| 58 |
|