CheckBox.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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\Shared\Text as SharedText;
  19. /**
  20. * Check box element
  21. *
  22. * @since 0.10.0
  23. */
  24. class CheckBox extends Text
  25. {
  26. /**
  27. * Name content
  28. *
  29. * @var string
  30. */
  31. private $name;
  32. /**
  33. * Create new instance
  34. *
  35. * @param string $name
  36. * @param string $text
  37. * @param mixed $fontStyle
  38. * @param mixed $paragraphStyle
  39. */
  40. public function __construct($name = null, $text = null, $fontStyle = null, $paragraphStyle = null)
  41. {
  42. $this->setName($name);
  43. parent::__construct($text, $fontStyle, $paragraphStyle);
  44. }
  45. /**
  46. * Set name content
  47. *
  48. * @param string $name
  49. * @return self
  50. */
  51. public function setName($name)
  52. {
  53. $this->name = SharedText::toUTF8($name);
  54. return $this;
  55. }
  56. /**
  57. * Get name content
  58. *
  59. * @return string
  60. */
  61. public function getName()
  62. {
  63. return $this->name;
  64. }
  65. }