You are here

private static function Time::assertInRange in Time Field For Drupal 8.x / 9.x 8

Same name and namespace in other branches
  1. 2.x src/Time.php \Drupal\time_field\Time::assertInRange()

Asserts that given value is between certain range.

Parameters

int $value: Value to check.

int $from: Lower bound of the assertion.

int $to: Higher bound of the assertion.

2 calls to Time::assertInRange()
Time::createFromTimestamp in src/Time.php
Creates Time object from timestamp.
Time::__construct in src/Time.php
Create Time instance.

File

src/Time.php, line 62

Class

Time
Time class represents time of day.

Namespace

Drupal\time_field

Code

private static function assertInRange($value, $from, $to) {
  if ($value < $from || $value > $to) {
    throw new \InvalidArgumentException('Provided value is out of range.');
  }
}