| @@ -109,8 +109,39 @@ | ||
| 109 | 109 | private bool $noBorder = false; |
| 110 | 110 | |
| 111 | 111 | private bool $roundedCorners = false; |
| 112 | 112 | |
| 113 | + private bool $date1904 = false; | |
| 114 | + | |
| 115 | + private string $lang = 'en-GB'; | |
| 116 | + | |
| 117 | + /** @var array{ | |
| 118 | + * b?: numeric-string, | |
| 119 | + * l?: numeric-string, | |
| 120 | + * r?: numeric-string, | |
| 121 | + * t?: numeric-string, | |
| 122 | + * header?: numeric-string, | |
| 123 | + * footer?: numeric-string, | |
| 124 | + * } | |
| 125 | + */ | |
| 126 | + private array $pageMargins = [ | |
| 127 | + 'b' => '0.75', | |
| 128 | + 'l' => '0.7', | |
| 129 | + 'r' => '0.7', | |
| 130 | + 't' => '0.75', | |
| 131 | + 'header' => '0.3', | |
| 132 | + 'footer' => '0.3', | |
| 133 | + ]; | |
| 134 | + | |
| 135 | + /** @var array{ | |
| 136 | + * paperSize?: string, | |
| 137 | + * orientation?: string, | |
| 138 | + * } | |
| 139 | + */ | |
| 140 | + private array $pageSetup = [ | |
| 141 | + 'orientation' => 'portrait', | |
| 142 | + ]; | |
| 143 | + | |
| 113 | 144 | private GridLines $borderLines; |
| 114 | 145 | |
| 115 | 146 | private ChartColor $fillColor; |
| 116 | 147 | |
| @@ -679,11 +710,13 @@ | ||
| 679 | 710 | { |
| 680 | 711 | return $this->autoTitleDeleted; |
| 681 | 712 | } |
| 682 | 713 | |
| 683 | - public function setAutoTitleDeleted(bool $autoTitleDeleted): self | |
| 714 | + public function setAutoTitleDeleted(?bool $autoTitleDeleted): self | |
| 684 | 715 | { |
| 685 | - $this->autoTitleDeleted = $autoTitleDeleted; | |
| 716 | + if (is_bool($autoTitleDeleted)) { | |
| 717 | + $this->autoTitleDeleted = $autoTitleDeleted; | |
| 718 | + } | |
| 686 | 719 | |
| 687 | 720 | return $this; |
| 688 | 721 | } |
| 689 | 722 | |
| @@ -724,8 +757,36 @@ | ||
| 724 | 757 | |
| 725 | 758 | return $this; |
| 726 | 759 | } |
| 727 | 760 | |
| 761 | + public function getDate1904(): bool | |
| 762 | + { | |
| 763 | + return $this->date1904; | |
| 764 | + } | |
| 765 | + | |
| 766 | + public function setDate1904(?bool $date1904): self | |
| 767 | + { | |
| 768 | + if ($date1904 !== null) { | |
| 769 | + $this->date1904 = $date1904; | |
| 770 | + } | |
| 771 | + | |
| 772 | + return $this; | |
| 773 | + } | |
| 774 | + | |
| 775 | + public function getLang(): string | |
| 776 | + { | |
| 777 | + return $this->lang; | |
| 778 | + } | |
| 779 | + | |
| 780 | + public function setLang(?string $lang): self | |
| 781 | + { | |
| 782 | + if ($lang !== null && $lang !== '') { | |
| 783 | + $this->lang = $lang; | |
| 784 | + } | |
| 785 | + | |
| 786 | + return $this; | |
| 787 | + } | |
| 788 | + | |
| 728 | 789 | public function getBorderLines(): GridLines |
| 729 | 790 | { |
| 730 | 791 | return $this->borderLines; |
| 731 | 792 | } |
| @@ -780,6 +841,60 @@ | ||
| 780 | 841 | $this->xAxis = clone $this->xAxis; |
| 781 | 842 | $this->yAxis = clone $this->yAxis; |
| 782 | 843 | $this->borderLines = clone $this->borderLines; |
| 783 | 844 | $this->fillColor = clone $this->fillColor; |
| 845 | + } | |
| 846 | + | |
| 847 | + /** @return array{ | |
| 848 | + * b?: numeric-string, | |
| 849 | + * l?: numeric-string, | |
| 850 | + * r?: numeric-string, | |
| 851 | + * t?: numeric-string, | |
| 852 | + * header?: numeric-string, | |
| 853 | + * footer?: numeric-string, | |
| 854 | + * } | |
| 855 | + */ | |
| 856 | + public function getPageMargins(): array | |
| 857 | + { | |
| 858 | + return $this->pageMargins; | |
| 859 | + } | |
| 860 | + | |
| 861 | + /** @param mixed $pageMargins expecting array matching $this->pageMargins */ | |
| 862 | + public function setPageMargins($pageMargins): self | |
| 863 | + { | |
| 864 | + if (is_array($pageMargins)) { | |
| 865 | + foreach (['b', 'l', 'r', 't', 'header', 'footer'] as $key) { | |
| 866 | + $value = $pageMargins[$key] ?? null; | |
| 867 | + if (is_string($value) && is_numeric($value)) { | |
| 868 | + $this->pageMargins[$key] = "$value"; | |
| 869 | + } | |
| 870 | + } | |
| 871 | + } | |
| 872 | + | |
| 873 | + return $this; | |
| 874 | + } | |
| 875 | + | |
| 876 | + /** @return array{ | |
| 877 | + * paperSize?: string, | |
| 878 | + * orientation?: string, | |
| 879 | + * } | |
| 880 | + */ | |
| 881 | + public function getPageSetup(): array | |
| 882 | + { | |
| 883 | + return $this->pageSetup; | |
| 884 | + } | |
| 885 | + | |
| 886 | + /** @param mixed $pageSetup expecting array matching $this->pageSetup */ | |
| 887 | + public function setPageSetup($pageSetup): self | |
| 888 | + { | |
| 889 | + if (is_array($pageSetup)) { | |
| 890 | + foreach (['paperSize', 'orientation'] as $key) { | |
| 891 | + $value = $pageSetup[$key] ?? null; | |
| 892 | + if (is_string($value)) { | |
| 893 | + $this->pageSetup[$key] = "$value"; | |
| 894 | + } | |
| 895 | + } | |
| 896 | + } | |
| 897 | + | |
| 898 | + return $this; | |
| 784 | 899 | } |
| 785 | 900 | } |