lists.php in Sassy 7
File
phamlp/sass/extensions/compass/functions/lists.php
View source
<?php
class SassExtentionsCompassFunctionsLists {
const SPACE_SEPARATOR = '/\\s+/';
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;
}
}
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;
}
}
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;
}
}
}
Classes
Name |
Description |
SassExtentionsCompassFunctionsLists |
Compass extension SassScript lists functions class.
A collection of functions for use in SassSCript.
@package PHamlP
@subpackage Sass.extensions.compass.functions |