Shape.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. /**
  3. * This file is part of PHPWord - A pure PHP library for reading and writing
  4. * word processing documents.
  5. *
  6. * PHPWord is free software distributed under the terms of the GNU Lesser
  7. * General Public License version 3 as published by the Free Software Foundation.
  8. *
  9. * For the full copyright and license information, please read the LICENSE
  10. * file that was distributed with this source code. For the full list of
  11. * contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
  12. *
  13. * @see https://github.com/PHPOffice/PHPWord
  14. * @copyright 2010-2018 PHPWord contributors
  15. * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
  16. */
  17. namespace PhpOffice\PhpWord\Element;
  18. use PhpOffice\PhpWord\Style\Shape as ShapeStyle;
  19. /**
  20. * Shape element
  21. *
  22. * @since 0.12.0
  23. */
  24. class Shape extends AbstractElement
  25. {
  26. /**
  27. * Shape type arc|curve|line|polyline|rect|oval
  28. *
  29. * @var string
  30. */
  31. private $type;
  32. /**
  33. * Shape style
  34. *
  35. * @var \PhpOffice\PhpWord\Style\Shape
  36. */
  37. private $style;
  38. /**
  39. * Create new instance
  40. *
  41. * @param string $type
  42. * @param mixed $style
  43. */
  44. public function __construct($type, $style = null)
  45. {
  46. $this->setType($type);
  47. $this->style = $this->setNewStyle(new ShapeStyle(), $style);
  48. }
  49. /**
  50. * Get type
  51. *
  52. * @return string
  53. */
  54. public function getType()
  55. {
  56. return $this->type;
  57. }
  58. /**
  59. * Set pattern
  60. *
  61. * @param string $value
  62. * @return self
  63. */
  64. public function setType($value = null)
  65. {
  66. $enum = array('arc', 'curve', 'line', 'polyline', 'rect', 'oval');
  67. $this->type = $this->setEnumVal($value, $enum, null);
  68. return $this;
  69. }
  70. /**
  71. * Get shape style
  72. *
  73. * @return \PhpOffice\PhpWord\Style\Shape
  74. */
  75. public function getStyle()
  76. {
  77. return $this->style;
  78. }
  79. }