private function SassNumber::removeCommonUnits in Sassy 7.3
Same name and namespace in other branches
- 7 phamlp/sass/script/literals/SassNumber.php \SassNumber::removeCommonUnits()
Removes common units from each set. We don't use array_diff because we want (for eaxmple) mm*mm/mm*cm to end up as mm/cm.
Parameters
array first set of units:
array second set of units:
Return value
array both sets of units with common units removed
2 calls to SassNumber::removeCommonUnits()
- SassNumber::coercionFactor in phpsass/
script/ literals/ SassNumber.php - Calculates the corecion factor to apply to the value
- SassNumber::__construct in phpsass/
script/ literals/ SassNumber.php - class constructor. Sets the value and units of the number.
File
- phpsass/
script/ literals/ SassNumber.php, line 371
Class
- SassNumber
- SassNumber class. Provides operations and type testing for Sass numbers. Units are of the passed value are converted the those of the class value if it has units. e.g. 2cm + 20mm = 4cm while 2 + 20mm = 22mm. @package PHamlP @subpackage …
Code
private function removeCommonUnits($u1, $u2) {
$_u1 = array();
while (!empty($u1)) {
$u = array_shift($u1);
$i = array_search($u, $u2);
if ($i !== false) {
unset($u2[$i]);
}
else {
$_u1[] = $u;
}
}
return array(
$_u1,
$u2,
);
}