You are here

public function CSSCompression_Combine_BorderOutline::combine in Advanced CSS/JS Aggregation 7

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

Combines color/style/width of border/outline properties

Parameters

(string) val: Rule Set:

File

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

Class

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

Code

public function combine($val) {
  $storage = $this
    ->storage($val);
  $pos = 0;

  // Now rebuild the string replacing all instances
  while (preg_match($this->rcsw, $val, $match, PREG_OFFSET_CAPTURE, $pos)) {
    $prop = $match[2][0];
    if (isset($storage[$prop])) {
      $colon = strlen($match[1][0]);
      $val = substr_replace($val, $storage[$prop], $match[0][1] + $colon, strlen($match[0][0]) - $colon);
      $pos = $match[0][1] + strlen($storage[$prop]) - $colon - 1;
      $storage[$prop] = '';
    }
    else {
      $pos = $match[0][1] + strlen($match[0][0]) - 1;
    }
  }

  // Return converted val
  return $val;
}