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