| 1 |
<?php |
| 2 |
|
| 3 |
namespace TablePress\PhpOffice\PhpSpreadsheet\Chart; |
| 4 |
|
| 5 |
use TablePress\PhpOffice\PhpSpreadsheet\Style\Font; |
| 6 |
|
| 7 |
class AxisText extends Properties |
| 8 |
{ |
| 9 |
private ?int $rotation = null; |
| 10 |
|
| 11 |
private Font $font; |
| 12 |
|
| 13 |
public function __construct() |
| 14 |
{ |
| 15 |
parent::__construct(); |
| 16 |
$this->font = new Font(); |
| 17 |
$this->font->setSize(null, true); |
| 18 |
} |
| 19 |
|
| 20 |
public function setRotation(?int $rotation): self |
| 21 |
{ |
| 22 |
$this->rotation = $rotation; |
| 23 |
|
| 24 |
return $this; |
| 25 |
} |
| 26 |
|
| 27 |
public function getRotation(): ?int |
| 28 |
{ |
| 29 |
return $this->rotation; |
| 30 |
} |
| 31 |
|
| 32 |
public function getFillColorObject(): ChartColor |
| 33 |
{ |
| 34 |
$fillColor = $this->font->getChartColor(); |
| 35 |
if ($fillColor === null) { |
| 36 |
$fillColor = new ChartColor(); |
| 37 |
$this->font->setChartColorFromObject($fillColor); |
| 38 |
} |
| 39 |
|
| 40 |
return $fillColor; |
| 41 |
} |
| 42 |
|
| 43 |
public function getFont(): Font |
| 44 |
{ |
| 45 |
return $this->font; |
| 46 |
} |
| 47 |
|
| 48 |
public function setFont(Font $font): self |
| 49 |
{ |
| 50 |
$this->font = $font; |
| 51 |
|
| 52 |
return $this; |
| 53 |
} |
| 54 |
|
| 55 |
/** |
| 56 |
* Implement PHP __clone to create a deep clone, not just a shallow copy. |
| 57 |
*/ |
| 58 |
public function __clone() |
| 59 |
{ |
| 60 |
parent::__clone(); |
| 61 |
$this->font = clone $this->font; |
| 62 |
} |
| 63 |
} |
| 64 |
|