You are here

public static function MeasurementType::getClass in Physical Fields 8

Gets the class for the given measurement type.

Parameters

string $type: The measurement type.

Return value

string The fully qualified class name.

1 call to MeasurementType::getClass()
MeasurementItem::toMeasurement in src/Plugin/Field/FieldType/MeasurementItem.php
Gets the Measurement value object for the current field item.

File

src/MeasurementType.php, line 41

Class

MeasurementType
Provides measurement types.

Namespace

Drupal\physical

Code

public static function getClass($type) {
  self::assertExists($type);
  $classes = [
    self::AREA => Area::class,
    self::LENGTH => Length::class,
    self::TEMPERATURE => Temperature::class,
    self::VOLUME => Volume::class,
    self::WEIGHT => Weight::class,
  ];
  return $classes[$type];
}