You are here

final class Length in Physical Fields 8

Provides a value object for length amounts.

Usage example:

$height = new Length('1.90', LengthUnit::METER);

Hierarchy

Expanded class hierarchy of Length

6 files declare their use of Length
DimensionsItem.php in src/Plugin/Field/FieldType/DimensionsItem.php
DimensionsItemTest.php in tests/src/Kernel/DimensionsItemTest.php
DimensionsTestForm.php in tests/modules/physical_test/src/Form/DimensionsTestForm.php
LengthTest.php in tests/src/Unit/LengthTest.php
MeasurementTest.php in tests/src/Unit/MeasurementTest.php

... See full list

5 string references to 'Length'
Dimensions::processElement in src/Element/Dimensions.php
Builds the physical_dimensions form element.
DimensionsConstraintValidator::validate in src/Plugin/Validation/Constraint/DimensionsConstraintValidator.php
Checks if the passed value is valid.
DimensionsItem::propertyDefinitions in src/Plugin/Field/FieldType/DimensionsItem.php
Defines field item properties.
MeasurementType::getLabels in src/MeasurementType.php
Gets the labels for the defined measurement types.
physical.schema.yml in config/schema/physical.schema.yml
config/schema/physical.schema.yml

File

src/Length.php, line 13

Namespace

Drupal\physical
View source
final class Length extends Measurement {

  /**
   * The measurement type.
   *
   * @var string
   */
  protected $type = MeasurementType::LENGTH;

}

Members

Namesort descending Modifiers Type Description Overrides
Length::$type protected property The measurement type. Overrides Measurement::$type
Measurement::$number protected property The number.
Measurement::$unit protected property The unit.
Measurement::add public function Adds the given measurement to the current one.
Measurement::compareTo public function Compares the current measurement with the given one.
Measurement::convert public function Converts the current measurement to a new unit. 1
Measurement::divide public function Divides the current measurement by the given number.
Measurement::equals public function Gets whether the current measurement is equivalent to the given one.
Measurement::getNumber public function Gets the number.
Measurement::getUnit public function Gets the unit.
Measurement::greaterThan public function Gets whether the current measurement is greater than the given one.
Measurement::greaterThanOrEqual public function Gets whether the current measurement is greater than or equal to the given one.
Measurement::isZero public function Gets whether the current measurement is zero.
Measurement::lessThan public function Gets whether the current measurement is lesser than the given measurement.
Measurement::lessThanOrEqual public function Gets whether the current measurement is lesser than or equal to the given measurement.
Measurement::multiply public function Multiplies the current measurement by the given number.
Measurement::round public function Rounds the current measurement.
Measurement::subtract public function Subtracts the given measurement from the current one.
Measurement::toArray public function Gets the array representation of the measurement.
Measurement::__construct public function Constructs a new Measurement object.
Measurement::__toString public function Gets the string representation of the measurement.