You are here

class SassExtentionsCompassFunctionsConstants in Sassy 7

Compass extension SassScript constants functions class. A collection of functions for use in SassSCript. @package PHamlP @subpackage Sass.extensions.compass.functions

Hierarchy

Expanded class hierarchy of SassExtentionsCompassFunctionsConstants

File

phamlp/sass/extensions/compass/functions/constants.php, line 18

View source
class SassExtentionsCompassFunctionsConstants {
  public static function opposite_position($pos) {
    $opposites = array();
    foreach (explode(' ', $pos
      ->toString()) as $position) {
      switch (trim($position)) {
        case 'top':
          $opposites[] = 'bottom';
          break;
        case 'right':
          $opposites[] = 'left';
          break;
        case 'bottom':
          $opposites[] = 'top';
          break;
        case 'left':
          $opposites[] = 'right';
          break;
        case 'center':
          $opposites[] = 'center';
          break;
        default:
          throw new Exception('Cannot determine the opposite of ' . trim($position));
      }
    }
    return new SassString(join(' ', $opposites));
  }

}

Members