You are here

private function lessc::unit in Less CSS Preprocessor 6

Same name and namespace in other branches
  1. 6.3 lessphp/lessc.inc.php \lessc::unit()
2 calls to lessc::unit()
lessc::color in ./lessc.inc.php
lessc::value in ./lessc.inc.php

File

./lessc.inc.php, line 609

Class

lessc

Code

private function unit(&$unit, $units = null) {
  if (!$units) {
    $units = $this->units;
  }
  if (!$this
    ->match('(-?[0-9]*(\\.)?[0-9]+)(' . implode('|', $units) . ')?', $m)) {
    throw new exception('parse error: failed to consume unit');
  }

  // throw on a default unit
  if (!isset($m[3])) {
    $m[3] = 'number';
  }
  $unit = array(
    $m[3],
    $m[1],
  );
  return $this;
}