Version 1
[yaffs-website] / web / core / lib / Drupal / Core / TypedData / Plugin / DataType / IntegerData.php
diff --git a/web/core/lib/Drupal/Core/TypedData/Plugin/DataType/IntegerData.php b/web/core/lib/Drupal/Core/TypedData/Plugin/DataType/IntegerData.php
new file mode 100644 (file)
index 0000000..8421dca
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+
+namespace Drupal\Core\TypedData\Plugin\DataType;
+
+use Drupal\Core\TypedData\PrimitiveBase;
+use Drupal\Core\TypedData\Type\IntegerInterface;
+
+/**
+ * The integer data type.
+ *
+ * The plain value of an integer is a regular PHP integer. For setting the value
+ * any PHP variable that casts to an integer may be passed.
+ *
+ * @DataType(
+ *   id = "integer",
+ *   label = @Translation("Integer")
+ * )
+ */
+class IntegerData extends PrimitiveBase implements IntegerInterface {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getCastedValue() {
+    return (int) $this->value;
+  }
+
+}