You are here

public function CSSCompression_Combine_Border::combine in Advanced CSS/JS Aggregation 6

Same name and namespace in other branches
  1. 7 advagg_css_compress/css-compressor-3.x/src/lib/Combine/Border.inc \CSSCompression_Combine_Border::combine()

Combines multiple border properties into single definition

Parameters

(string) val: Rule Set:

File

advagg_css_compress/css-compressor-3.x/src/lib/Combine/Border.inc, line 36

Class

CSSCompression_Combine_Border
CSS Compressor [VERSION] [DATE] Corey Hart @ http://www.codenothing.com

Code

public function combine($val) {
  if (($replace = $this
    ->replace($val)) === false) {
    return $val;
  }

  // Rebuild the rule set with the combinations found
  $pos = 0;
  while (preg_match($this->rborder, $val, $match, PREG_OFFSET_CAPTURE, $pos)) {
    $colon = strlen($match[1][0]);
    $val = substr_replace($val, $replace, $match[0][1] + $colon, strlen($match[0][0]) - $colon);
    $pos = $match[0][1] + strlen($replace) - $colon - 1;
    $replace = '';
  }

  // Return converted val
  return $val;
}