PageMargins.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <?php
  2. namespace PhpOffice\PhpSpreadsheet\Worksheet;
  3. class PageMargins
  4. {
  5. /**
  6. * Left.
  7. *
  8. * @var float
  9. */
  10. private $left = 0.7;
  11. /**
  12. * Right.
  13. *
  14. * @var float
  15. */
  16. private $right = 0.7;
  17. /**
  18. * Top.
  19. *
  20. * @var float
  21. */
  22. private $top = 0.75;
  23. /**
  24. * Bottom.
  25. *
  26. * @var float
  27. */
  28. private $bottom = 0.75;
  29. /**
  30. * Header.
  31. *
  32. * @var float
  33. */
  34. private $header = 0.3;
  35. /**
  36. * Footer.
  37. *
  38. * @var float
  39. */
  40. private $footer = 0.3;
  41. /**
  42. * Create a new PageMargins.
  43. */
  44. public function __construct()
  45. {
  46. }
  47. /**
  48. * Get Left.
  49. *
  50. * @return float
  51. */
  52. public function getLeft()
  53. {
  54. return $this->left;
  55. }
  56. /**
  57. * Set Left.
  58. *
  59. * @param float $pValue
  60. *
  61. * @return PageMargins
  62. */
  63. public function setLeft($pValue)
  64. {
  65. $this->left = $pValue;
  66. return $this;
  67. }
  68. /**
  69. * Get Right.
  70. *
  71. * @return float
  72. */
  73. public function getRight()
  74. {
  75. return $this->right;
  76. }
  77. /**
  78. * Set Right.
  79. *
  80. * @param float $pValue
  81. *
  82. * @return PageMargins
  83. */
  84. public function setRight($pValue)
  85. {
  86. $this->right = $pValue;
  87. return $this;
  88. }
  89. /**
  90. * Get Top.
  91. *
  92. * @return float
  93. */
  94. public function getTop()
  95. {
  96. return $this->top;
  97. }
  98. /**
  99. * Set Top.
  100. *
  101. * @param float $pValue
  102. *
  103. * @return PageMargins
  104. */
  105. public function setTop($pValue)
  106. {
  107. $this->top = $pValue;
  108. return $this;
  109. }
  110. /**
  111. * Get Bottom.
  112. *
  113. * @return float
  114. */
  115. public function getBottom()
  116. {
  117. return $this->bottom;
  118. }
  119. /**
  120. * Set Bottom.
  121. *
  122. * @param float $pValue
  123. *
  124. * @return PageMargins
  125. */
  126. public function setBottom($pValue)
  127. {
  128. $this->bottom = $pValue;
  129. return $this;
  130. }
  131. /**
  132. * Get Header.
  133. *
  134. * @return float
  135. */
  136. public function getHeader()
  137. {
  138. return $this->header;
  139. }
  140. /**
  141. * Set Header.
  142. *
  143. * @param float $pValue
  144. *
  145. * @return PageMargins
  146. */
  147. public function setHeader($pValue)
  148. {
  149. $this->header = $pValue;
  150. return $this;
  151. }
  152. /**
  153. * Get Footer.
  154. *
  155. * @return float
  156. */
  157. public function getFooter()
  158. {
  159. return $this->footer;
  160. }
  161. /**
  162. * Set Footer.
  163. *
  164. * @param float $pValue
  165. *
  166. * @return PageMargins
  167. */
  168. public function setFooter($pValue)
  169. {
  170. $this->footer = $pValue;
  171. return $this;
  172. }
  173. /**
  174. * Implement PHP __clone to create a deep clone, not just a shallow copy.
  175. */
  176. public function __clone()
  177. {
  178. $vars = get_object_vars($this);
  179. foreach ($vars as $key => $value) {
  180. if (is_object($value)) {
  181. $this->$key = clone $value;
  182. } else {
  183. $this->$key = $value;
  184. }
  185. }
  186. }
  187. }