class SassBoolean in Sassy 7.3
Same name and namespace in other branches
- 7 phamlp/sass/script/literals/SassBoolean.php \SassBoolean
SassBoolean class. @package PHamlP @subpackage Sass.script.literals
Hierarchy
- class \SassLiteral
- class \SassBoolean
Expanded class hierarchy of SassBoolean
1 string reference to 'SassBoolean'
- SassScriptFunctions::adjust in phpsass/
script/ SassScriptFunctions.php - Adjusts the colour
File
- phpsass/
script/ literals/ SassBoolean.php, line 19
View source
class SassBoolean extends SassLiteral {
/**@#+
* Regex for matching and extracting booleans
*/
const MATCH = '/^(true|false)\\b/';
/**
* SassBoolean constructor
* @param string value of the boolean type
* @return SassBoolean
*/
public function __construct($value) {
if (is_bool($value)) {
$this->value = $value;
}
elseif ($value === 'true' || $value === 'false') {
$this->value = $value === 'true' ? true : false;
}
else {
throw new SassBooleanException('Invalid SassBoolean', SassScriptParser::$context->node);
}
}
/**
* Returns the value of this boolean.
* @return boolean the value of this boolean
*/
public function getValue() {
return $this->value;
}
/**
* Returns a string representation of the value.
* @return string string representation of the value.
*/
public function toString() {
return $this
->getValue() ? 'true' : 'false';
}
/**
* Returns a value indicating if a token of this type can be matched at
* the start of the subject string.
* @param string the subject string
* @return mixed match at the start of the string or false if no match
*/
public static function isa($subject) {
return preg_match(self::MATCH, $subject, $matches) ? $matches[0] : false;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SassBoolean:: |
public | function |
Returns the value of this boolean. Overrides SassLiteral:: |
|
SassBoolean:: |
public static | function |
Returns a value indicating if a token of this type can be matched at
the start of the subject string. Overrides SassLiteral:: |
|
SassBoolean:: |
constant | |||
SassBoolean:: |
public | function |
Returns a string representation of the value. Overrides SassLiteral:: |
|
SassBoolean:: |
public | function |
SassBoolean constructor Overrides SassLiteral:: |
|
SassLiteral:: |
public static | property | ||
SassLiteral:: |
public | property | ||
SassLiteral:: |
public | function | Adds a child object to this. | |
SassLiteral:: |
public static | function | Asserts that the value of a literal is within the expected range | |
SassLiteral:: |
public static | function | Asserts that the literal is the expected type | |
SassLiteral:: |
public | function | Returns the type of this | |
SassLiteral:: |
public | function | The SassScript and operation. | |
SassLiteral:: |
public | function | ||
SassLiteral:: |
public | function | Bitwise AND the value of other and this value | 1 |
SassLiteral:: |
public | function | Bitwise NOT the value of other and the value of this | |
SassLiteral:: |
public | function | Bitwise OR the value of other and this value | 1 |
SassLiteral:: |
public | function | Bitwise XOR the value of other and the value of this | 1 |
SassLiteral:: |
public | function | SassScript ',' operation. | |
SassLiteral:: |
public | function | The SassScript default operation (e.g. $a $b, "foo" "bar"). | |
SassLiteral:: |
public | function | SassScript '/' operation. | 2 |
SassLiteral:: |
public | function | The SassScript == operation. | 1 |
SassLiteral:: |
public | function | The SassScript > operation. | 1 |
SassLiteral:: |
public | function | The SassScript >= operation. | 1 |
SassLiteral:: |
public | function | The SassScript < operation. | 1 |
SassLiteral:: |
public | function | The SassScript <= operation. | 1 |
SassLiteral:: |
public | function | SassScript '-' operation. | 2 |
SassLiteral:: |
public | function | SassScript '%' operation. | 2 |
SassLiteral:: |
public | function | The SassScript != operation. | |
SassLiteral:: |
public | function | The SassScript not operation. | 1 |
SassLiteral:: |
public | function | The SassScript or operation. | |
SassLiteral:: |
public | function | SassScript '+' operation. | 3 |
SassLiteral:: |
public | function | Shifts the value of this left by the number of bits given in value | 1 |
SassLiteral:: |
public | function | Shifts the value of this right by the number of bits given in value | 1 |
SassLiteral:: |
public | function | SassScript '*' operation. | 3 |
SassLiteral:: |
public | function | The SassScript xor operation. | |
SassLiteral:: |
public | function | Returns the boolean representation of the value of this | |
SassLiteral:: |
public | function | Getter. | |
SassLiteral:: |
public | function |