Newer
Older
Dries Buytaert
committed
<?php
Alex Pott
committed
namespace Drupal\Core\TypedData\Plugin\DataType;
Dries Buytaert
committed
Alex Pott
committed
use Drupal\Core\TypedData\PrimitiveBase;
use Drupal\Core\TypedData\Type\IntegerInterface;
Dries Buytaert
committed
/**
* 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.
Alex Pott
committed
*
* @DataType(
* id = "integer",
Alex Pott
committed
* label = @Translation("Integer")
Alex Pott
committed
* )
Dries Buytaert
committed
*/
class IntegerData extends PrimitiveBase implements IntegerInterface {
Dries Buytaert
committed
Dries Buytaert
committed
/**
* {@inheritdoc}
Dries Buytaert
committed
*/
public function getCastedValue() {
return (int) $this->value;
}