SourceString.php 871 B

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