SimpleDescription.php 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /*
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. //require 'Yay/Description.php';
  15. /**
  16. * A basic Description container for error messages.
  17. * @author Chris Corbyn <chris@w3style.co.uk>
  18. * @package Yay
  19. */
  20. class Yay_SimpleDescription implements Yay_Description
  21. {
  22. /**
  23. * An internal text buffer.
  24. * @var string
  25. * @access private
  26. */
  27. private $_text = '';
  28. /**
  29. * Append an existing Description to this Description.
  30. * @param Yay_Description
  31. */
  32. public function appendDescription(Yay_Description $description)
  33. {
  34. $this->_text .= $description->toString();
  35. }
  36. /**
  37. * Append text content to this Description.
  38. * @param string $text
  39. */
  40. public function appendText($text)
  41. {
  42. $this->_text .= $text;
  43. }
  44. /**
  45. * Get this description back as a formatted string.
  46. * @return string
  47. */
  48. public function toString()
  49. {
  50. return $this->_text;
  51. }
  52. }