PrimitiveBase.php 588 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace Drupal\Core\TypedData;
  3. /**
  4. * Base class for primitive data types.
  5. */
  6. abstract class PrimitiveBase extends TypedData implements PrimitiveInterface {
  7. /**
  8. * The data value.
  9. *
  10. * @var mixed
  11. */
  12. protected $value;
  13. /**
  14. * {@inheritdoc}
  15. */
  16. public function getValue() {
  17. return $this->value;
  18. }
  19. /**
  20. * {@inheritdoc}
  21. */
  22. public function setValue($value, $notify = TRUE) {
  23. $this->value = $value;
  24. // Notify the parent of any changes.
  25. if ($notify && isset($this->parent)) {
  26. $this->parent->onChange($this->name);
  27. }
  28. }
  29. }