class SassExtentionsCompassFunctionsLists in Sassy 7
Compass extension SassScript lists functions class. A collection of functions for use in SassSCript. @package PHamlP @subpackage Sass.extensions.compass.functions
Hierarchy
Expanded class hierarchy of SassExtentionsCompassFunctionsLists
File
- phamlp/
sass/ extensions/ compass/ functions/ lists.php, line 18
View source
class SassExtentionsCompassFunctionsLists {
const SPACE_SEPARATOR = '/\\s+/';
# Return the first value from a space separated list.
public static function first_value_of($list) {
if ($list instanceof SassString) {
$items = preg_split(self::SPACE_SEPARATOR, $list->value);
return new SassString($items[0]);
}
else {
return $list;
}
}
# Return the nth value from a space separated list.
public static function nth_value_of($list, $n) {
if ($list instanceof SassString) {
$items = preg_split(self::SPACE_SEPARATOR, $list->value);
return new SassString($items[$n
->toInt() - 1]);
}
else {
return $list;
}
}
# Return the last value from a space separated list.
public static function last_value_of($list) {
if ($list instanceof SassString) {
$items = array_reverse(preg_split(self::SPACE_SEPARATOR, $list->value));
return new SassString($items[0]);
}
else {
return $list;
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SassExtentionsCompassFunctionsLists:: |
public static | function | ||
SassExtentionsCompassFunctionsLists:: |
public static | function | ||
SassExtentionsCompassFunctionsLists:: |
public static | function | ||
SassExtentionsCompassFunctionsLists:: |
constant |