You are here

public static function SassLiteral::assertType in Sassy 7.3

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

Asserts that the literal is the expected type

Parameters

SassLiteral the literal to test:

string expected type:

Throws

SassScriptFunctionException if value is not the expected type

25 calls to SassLiteral::assertType()
SassScriptFunctions::abs in phpsass/script/SassScriptFunctions.php
Finds the absolute value of a number. For example: abs(10px) => 10px abs(-10px) => 10px
SassScriptFunctions::adjust in phpsass/script/SassScriptFunctions.php
Adjusts the colour
SassScriptFunctions::adjust_hue in phpsass/script/SassScriptFunctions.php
Changes the hue of a colour while retaining the lightness and saturation.
SassScriptFunctions::alpha in phpsass/script/SassScriptFunctions.php
Returns the alpha component (opacity) of a colour.
SassScriptFunctions::blue in phpsass/script/SassScriptFunctions.php
Returns the blue component of a colour.

... See full list

File

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

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 assertType($literal, $type) {
  if (!$literal instanceof $type) {
    throw new SassScriptFunctionException(($literal instanceof SassLiteral ? $literal->typeOf : 'literal') . ' must be a ' . $type, SassScriptParser::$context->node);
  }
}