You are here

public static function SassLiteral::assertType in Sassy 7

Same name and namespace in other branches
  1. 7.3 phpsass/script/literals/SassLiteral.php \SassLiteral::assertType()

* Asserts that the literal is the expected type *

Parameters

SassLiteral the literal to test: * @param string expected type * @throws SassScriptFunctionException if value is not the expected type

27 calls to SassLiteral::assertType()
SassExtentionsCompassFunctionsColourStops::grad_colour_stops in phamlp/sass/extensions/compass/functions/colourStops.php
SassExtentionsCompassFunctionsColourStops::grad_end_position in phamlp/sass/extensions/compass/functions/colourStops.php
SassExtentionsCompassFunctionsColourStops::grad_position in phamlp/sass/extensions/compass/functions/colourStops.php
SassScriptFunctions::abs in phamlp/sass/script/SassScriptFunctions.php
* Finds the absolute value of a number. * For example: * abs(10px) => 10px * abs(-10px) => 10px * *
SassScriptFunctions::adjust in phamlp/sass/script/SassScriptFunctions.php
* Adjusts the colour *

... See full list

File

phamlp/sass/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('{what} must be a {type}', array(
      '{what}' => $literal instanceof SassLiteral ? $literal->typeOf : 'literal',
      '{type}' => $type,
    ), SassScriptParser::$context->node);
  }
}