summaryrefslogtreecommitdiffstats
path: root/core/lib/Drupal/Core/TypedData/Plugin/DataType/IntegerData.php
diff options
context:
space:
mode:
authorAlex Pott2015-03-24 11:20:03 +0000
committerAlex Pott2015-03-24 11:20:03 +0000
commit58481b72f52526627c8b083066203c3d2f847bb6 (patch)
treef725a2bf62d9b947e5ab5c6ca56732e927033788 /core/lib/Drupal/Core/TypedData/Plugin/DataType/IntegerData.php
parent11f554993702b64202a2682af92f1a1b52113e97 (diff)
Issue #2454441 by rteijeiro, hussainweb, 17thColossus, nullkernel: Rename Typed Data classes to support PHP 7
Diffstat (limited to 'core/lib/Drupal/Core/TypedData/Plugin/DataType/IntegerData.php')
-rw-r--r--core/lib/Drupal/Core/TypedData/Plugin/DataType/IntegerData.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/core/lib/Drupal/Core/TypedData/Plugin/DataType/IntegerData.php b/core/lib/Drupal/Core/TypedData/Plugin/DataType/IntegerData.php
new file mode 100644
index 0000000..2244e96
--- /dev/null
+++ b/core/lib/Drupal/Core/TypedData/Plugin/DataType/IntegerData.php
@@ -0,0 +1,32 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\TypedData\Plugin\DataType\IntegerData.
+ */
+
+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;
+ }
+}