You are here

public static function SassLiteral::assertInRange in Sassy 7.3

Same name and namespace in other branches
  1. 7 phamlp/sass/script/literals/SassLiteral.php \SassLiteral::assertInRange()

Asserts that the value of a literal is within the expected range

Parameters

SassLiteral the literal to test:

float the minimum value:

float the maximum value:

string the units.:

Throws

SassScriptFunctionException if value is not the expected type

4 calls to SassLiteral::assertInRange()
SassScriptFunctions::adjust in phpsass/script/SassScriptFunctions.php
Adjusts the colour
SassScriptFunctions::hsla in phpsass/script/SassScriptFunctions.php
Creates a SassColour object from hue, saturation, lightness and alpha channel (opacity).
SassScriptFunctions::mix in phpsass/script/SassScriptFunctions.php
Mixes two colours together. Takes the average of each of the RGB components, optionally weighted by the given percentage. The opacity of the colours is also considered when weighting the components. The weight specifies the amount of the first colour…
SassScriptFunctions::rgba in phpsass/script/SassScriptFunctions.php
Creates a SassColour object from red, green, and blue values and alpha channel (opacity). There are two overloads:

File

phpsass/script/literals/SassLiteral.php, line 344

Class

SassLiteral
SassLiteral class. Base class for all Sass literals. Sass data types are extended from this class and these override the operation methods to provide the appropriate semantics. @package PHamlP @subpackage Sass.script.literals

Code

public static function assertInRange($literal, $min, $max, $units = '') {
  if ($literal->value < $min || $literal->value > $max) {
    throw new SassScriptFunctionException($literal->typeOf . ' must be between ' . $min . $units . ' and ' . $max . $units . ' inclusive', SassScriptParser::$context->node);
  }
}