PHP Class SassLiteral

Base class for all Sass literals. Sass data types are extended from this class.
Mostra file Open project: richthegeek/phpsass Class Usage Examples

Public Properties

Property Type Description
$typeOf maps class names to data types
$value value of the literal type

Public Methods

Method Description
__construct ( string $value = null, $context ) : SassLiteral class constructor
__get ( string $name ) : mixed Getter.
__toString ( )
addChild ( sassLiteral $sassLiteral ) Adds a child object to this.
assertInRange ( SassLiteral $literal, float $min, float $max, string $units = '' ) Asserts that the value of a literal is within the expected range
assertType ( $literal, string $type ) Asserts that the literal is the expected type
getChildren ( )
getTypeOf ( ) : string Returns the type of this
getValue ( ) : mixed Returns the value of this
isa ( string $subject ) : mixed Returns a value indicating if a token of this type can be matched at the start of the subject string.
op_and ( sassLiteral $other ) : SassLiteral The SassScript and operation.
op_assign ( $other )
op_bw_and ( string $other ) : string Bitwise AND the value of other and this value
op_bw_not ( ) : string Bitwise NOT the value of other and the value of this
op_bw_or ( SassNumber $other ) : string Bitwise OR the value of other and this value
op_bw_xor ( SassNumber $other ) : string Bitwise XOR the value of other and the value of this
op_comma ( sassLiteral $other ) : sassString SassScript ',' operation.
op_concat ( sassLiteral $other ) : sassString The SassScript default operation (e.g. $a $b, "foo" "bar").
op_div ( SassLiteral $other ) : sassString SassScript '/' operation.
op_eq ( sassLiteral $other ) : SassBoolean The SassScript == operation.
op_gt ( sassLiteral $other ) : SassBoolean The SassScript > operation.
op_gte ( sassLiteral $other ) : SassBoolean The SassScript >= operation.
op_lt ( sassLiteral $other ) : SassBoolean The SassScript < operation.
op_lte ( sassLiteral $other ) : SassBoolean The SassScript <= operation.
op_minus ( SassLiteral $other ) : sassString SassScript '-' operation.
op_modulo ( SassLiteral $other ) : SassLiteral SassScript '%' operation.
op_neq ( sassLiteral $other ) : SassBoolean The SassScript != operation.
op_not ( ) : SassBoolean The SassScript not operation.
op_or ( sassLiteral $other ) : SassLiteral The SassScript or operation.
op_plus ( sassLiteral $other ) : sassString SassScript '+' operation.
op_shiftl ( SassNumber $other ) : string Shifts the value of this left by the number of bits given in value
op_shiftr ( SassNumber $other ) : string Shifts the value of this right by the number of bits given in value
op_times ( SassLiteral $other ) : sassString SassScript '*' operation.
op_xor ( sassLiteral $other ) : SassBoolean The SassScript xor operation.
render ( )
toBoolean ( ) : boolean Returns the boolean representation of the value of this
toString ( ) : string Returns a string representation of the value.

Method Details

__construct() public method

class constructor
public __construct ( string $value = null, $context ) : SassLiteral
$value string value of the literal type
return SassLiteral

__get() public method

Getter.
public __get ( string $name ) : mixed
$name string name of property to get
return mixed return value of getter function

__toString() public method

public __toString ( )

addChild() public method

Adds a child object to this.
public addChild ( sassLiteral $sassLiteral )
$sassLiteral sassLiteral the child object

assertInRange() public static method

Asserts that the value of a literal is within the expected range
public static assertInRange ( SassLiteral $literal, float $min, float $max, string $units = '' )
$literal SassLiteral the literal to test
$min float the minimum value
$max float the maximum value
$units string the units.

assertType() public static method

Asserts that the literal is the expected type
public static assertType ( $literal, string $type )
$type string expected type

getChildren() public method

public getChildren ( )

getTypeOf() public method

Returns the type of this
public getTypeOf ( ) : string
return string the type of this

getValue() public method

Returns the value of this
public getValue ( ) : mixed
return mixed the value of this

isa() public static method

Returns a value indicating if a token of this type can be matched at the start of the subject string.
public static isa ( string $subject ) : mixed
$subject string the subject string
return mixed match at the start of the string or false if no match

op_and() public method

The SassScript and operation.
public op_and ( sassLiteral $other ) : SassLiteral
$other sassLiteral the value to and with this
return SassLiteral other if this is boolean true, this if false

op_assign() public method

public op_assign ( $other )

op_bw_and() public method

Bitwise AND the value of other and this value
public op_bw_and ( string $other ) : string
$other string value to bitwise AND with
return string result

op_bw_not() public method

Bitwise NOT the value of other and the value of this
public op_bw_not ( ) : string
return string result

op_bw_or() public method

Bitwise OR the value of other and this value
public op_bw_or ( SassNumber $other ) : string
$other SassNumber value to bitwise OR with
return string result

op_bw_xor() public method

Bitwise XOR the value of other and the value of this
public op_bw_xor ( SassNumber $other ) : string
$other SassNumber value to bitwise XOR with
return string result

op_comma() public method

SassScript ',' operation.
public op_comma ( sassLiteral $other ) : sassString
$other sassLiteral the value to concatenate with a comma to this
return sassString the string values of this and other seperated by ","

op_concat() public method

The SassScript default operation (e.g. $a $b, "foo" "bar").
public op_concat ( sassLiteral $other ) : sassString
$other sassLiteral the value to concatenate with a space to this
return sassString the string values of this and other seperated by " "

op_div() public method

SassScript '/' operation.
public op_div ( SassLiteral $other ) : sassString
$other SassLiteral value to divide by
return sassString the string values of this and other seperated by '/'

op_eq() public method

The SassScript == operation.
public op_eq ( sassLiteral $other ) : SassBoolean
$other sassLiteral the value to compare to this
return SassBoolean SassBoolean object with the value true if this and other are equal, false if they are not

op_gt() public method

The SassScript > operation.
public op_gt ( sassLiteral $other ) : SassBoolean
$other sassLiteral the value to compare to this
return SassBoolean SassBoolean object with the value true if the values of this is greater than the value of other, false if it is not

op_gte() public method

The SassScript >= operation.
public op_gte ( sassLiteral $other ) : SassBoolean
$other sassLiteral the value to compare to this
return SassBoolean SassBoolean object with the value true if the values of this is greater than or equal to the value of other, false if it is not

op_lt() public method

The SassScript < operation.
public op_lt ( sassLiteral $other ) : SassBoolean
$other sassLiteral the value to compare to this
return SassBoolean SassBoolean object with the value true if the values of this is less than the value of other, false if it is not

op_lte() public method

The SassScript <= operation.
public op_lte ( sassLiteral $other ) : SassBoolean
$other sassLiteral the value to compare to this
return SassBoolean SassBoolean object with the value true if the values of this is less than or equal to the value of other, false if it is not

op_minus() public method

SassScript '-' operation.
public op_minus ( SassLiteral $other ) : sassString
$other SassLiteral value to subtract
return sassString the string values of this and other seperated by '-'

op_modulo() public method

SassScript '%' operation.
public op_modulo ( SassLiteral $other ) : SassLiteral
$other SassLiteral value to take the modulus of
return SassLiteral result

op_neq() public method

The SassScript != operation.
public op_neq ( sassLiteral $other ) : SassBoolean
$other sassLiteral the value to compare to this
return SassBoolean SassBoolean object with the value true if this and other are not equal, false if they are

op_not() public method

The SassScript not operation.
public op_not ( ) : SassBoolean
return SassBoolean SassBoolean object with the value true if the boolean of this is false or false if it is true

op_or() public method

The SassScript or operation.
public op_or ( sassLiteral $other ) : SassLiteral
$other sassLiteral the value to or with this
return SassLiteral this if this is boolean true, other if false

op_plus() public method

SassScript '+' operation.
public op_plus ( sassLiteral $other ) : sassString
$other sassLiteral value to add
return sassString the string values of this and other with no seperation

op_shiftl() public method

Shifts the value of this left by the number of bits given in value
public op_shiftl ( SassNumber $other ) : string
$other SassNumber amount to shift left by
return string result

op_shiftr() public method

Shifts the value of this right by the number of bits given in value
public op_shiftr ( SassNumber $other ) : string
$other SassNumber amount to shift right by
return string result

op_times() public method

SassScript '*' operation.
public op_times ( SassLiteral $other ) : sassString
$other SassLiteral value to multiply by
return sassString the string values of this and other seperated by '*'

op_xor() public method

The SassScript xor operation.
public op_xor ( sassLiteral $other ) : SassBoolean
$other sassLiteral the value to xor with this
return SassBoolean SassBoolean object with the value true if this or other, but not both, are true, false if not

render() public method

public render ( )

toBoolean() public method

Returns the boolean representation of the value of this
public toBoolean ( ) : boolean
return boolean the boolean representation of the value of this

toString() abstract public method

Returns a string representation of the value.
abstract public toString ( ) : string
return string string representation of the value.

Property Details

$typeOf public_oe static_oe property

maps class names to data types
public static $typeOf

$value public_oe property

value of the literal type
public $value