SourceString.php 1018 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * @file
  4. * Definition of SourceString.
  5. */
  6. /**
  7. * Defines the locale source string object.
  8. *
  9. * This class represents a module-defined string value that is to be translated.
  10. * This string must at least contain a 'source' field, which is the raw source
  11. * value, and is assumed to be in English language.
  12. */
  13. class SourceString extends StringBase {
  14. /**
  15. * Implements StringInterface::isSource().
  16. */
  17. public function isSource() {
  18. return isset($this->source);
  19. }
  20. /**
  21. * Implements StringInterface::isTranslation().
  22. */
  23. public function isTranslation() {
  24. return FALSE;
  25. }
  26. /**
  27. * Implements LocaleString::getString().
  28. */
  29. public function getString() {
  30. return isset($this->source) ? $this->source : '';
  31. }
  32. /**
  33. * Implements LocaleString::setString().
  34. */
  35. public function setString($string) {
  36. $this->source = $string;
  37. return $this;
  38. }
  39. /**
  40. * Implements LocaleString::isNew().
  41. */
  42. public function isNew() {
  43. return empty($this->lid);
  44. }
  45. }