Converts a value from one unit to another.
@param string $from unit to convert from
@param string $to unit to convert to
@param mixed $value value to convert
@return float converted value
324829
protected function convert($from, $to, $value)
    {
        return ($value * $this->getConversionRate($from)) / $this->getConversionRate($to);
    }
222416
public function betweenStrict($from, $to)
    {
        if (!is_int($from) && !is_float($from)) {
            throw new InvalidIntOrFloatException('from', $from);
        } elseif (!is_int($to) && !is_float($to)) {
            throw new InvalidIntOrFloatException('to', $to);
        } elseif ($from > $to) {
            throw new NumberNotLessStrictlyException('from', $from, $to);
        }

        if (!is_int($this->value) && !is_float($this->value)) {
            throw new InvalidIntOrFloatException($this->name, $this->value);
        } elseif ($this->value <= $from || $this->value >= $to) {
            throw new NumberNotBetweenStrictlyException($this->name, $this->value, $from, $to);
        }

        return $this;
    }
726534
public static function merge(array $to, array $from)
    {
        $args = func_get_args();
        $res = array_shift($args);
        while (!empty($args)) {
            $next = array_shift($args);
            foreach ($next as $k => $v) {
                if (is_integer($k)) {
                    isset($res[$k]) ? $res[] = $v : $res[$k] = $v;
                } elseif (is_array($v) && isset($res[$k]) && is_array($res[$k])) {
                    $res[$k] = self::merge($res[$k], $v);
                } else {
                    $res[$k] = $v;
                }
            }
        }
        return $res;
    }
228709
public static function _convertTZ ($date, $to, $format = 'Y-m-d H:i:s', $from = 'UTC')
	{
		
		$date = new \DateTime ($date, new \DateTimeZone ($from));
		$date->setTimezone (new \DateTimeZone ($to));
		
		return $date->format ($format);
		
	}
1092888
public static function ConvertEncoding($value, $to, $from)
	{
		if (self::getIsMbstringEnabled()) {
			$value = mb_convert_encoding($value, $to, $from);
			return $value;
		}

		if (self::getIsIconvEnabled()) {
			$value = iconv($from, $to, $value);
			return $value;
		}

		// else, no conversion
		return $value;
	}
369642
public static function convert($date, $from = 'UTC', $to = 'UTC', $format = null)
    {
        $format = $format ?: self::$format;

        $from = new \DateTimeZone($from);
        $to   = new \DateTimeZone($to);
        $date = new static($date, $from);

        $date = $date->setTimezone($to);

        return $date->format($format, true);
    }
928463
public function to($to = null) {
        if ($to === null) {
            return $this->to;
        }

        $this->to = (int) $to;

        return $this;
    }
969399
protected function moveUploadedFile($from, $to)
    {
        return $this->unitTest ? copy($from, $to) : @move_uploaded_file($from, $to);
    }
288835
public static function format($value, $to, $from = null)
    {
        if ($to instanceof Measure === false) {
            throw new Exception('Unknown object');
        }
        if ($from instanceof Measure) {
            $value = static::convert($value, $to, $from);
        }
        $formatter = $to->use_custom_formatter == true ? $to->formatter : \Yii::$app->formatter;
        return strtr(
            $to->format,
            [
                '#' => $formatter->asDecimal($value),
                '$' => static::t($to->unit),
            ]
        );
    }
270195
public static function convert($value, $to, $from)
    {
        if ($from instanceof Measure === false || $to instanceof Measure === false) {
            throw new Exception('`from` or `to` parameter is not a Measure');
        }
        if ($from->type !== $to->type) {
            throw new Exception('Measures have different types');
        }
        if ($from->id == $to->id) {
            return $value;
        }
        $converterClass = isset(static::$converters[$to->type]) === true
            ? static::$converters[$to->type]
            : 'DevGroup\Measure\converters\DefaultMeasureTypeConverter';
        return $converterClass::convert($value, $to, $from);
    }
230326
private function resolveTo($to, $from)
    {
        if (is_string($to)) {
            $to = strtolower($to);
        }

        if ($to === 'down') {
            $to = $this->versionCollection->getPreviousVersion($from);
        }

        if ($to === 'up') {
            $to = $this->versionCollection->getNextVersion($from);
        }

        if ($to === 'bottom') {
            $to = 0;
        }

        if ($to === 'top' || null === $to) {
            $to = $this->versionCollection->getLatestVersion();
        }

        if (0 !== $to && false === strtotime($to)) {
            throw new MigratorException(sprintf(
                'Unknown migration action "%s". Known actions: "%s"',
                $to,
                implode('", "', $this->actions)
            ));
        }

        if (0 !== $to && !$this->versionCollection->has($to)) {
            throw new MigratorException(sprintf(
                'Unknown version "%s"', $to
            ));
        }

        return $to;
    }
1173736
def convert(self, value, fromunits, tounits):
        ''''''
        if fromunits == tounits:
            return value
        if (fromunits,tounits) in self.unitmap:
            return value * self.unitmap[(fromunits,tounits)]
        if (tounits,fromunits) in self.unitmap:
            return value / self.unitmap[(tounits,fromunits)]
        raise fgFDMError("unknown unit mapping (%s,%s)" % (fromunits, tounits))
581690
public static function rename($from, $to)
    {
        $object = get_class(self::$driver);

        return $object::rename($from, $to);
    }
551856
protected function fail($value, $to)
  {
    if (true)
    {
      throw new TransformerException(
        sprintf("Value of type %s can not be converted to %s by this method.", gettype($value), $to)
      );
    }

    return false;
  }
761130
public function removeClassName($from = 'class', $value = null)
    {
        $classes = explode(' ', (string) $this->getAttribute($from));

        $value = array_diff($classes, is_string($value) ? explode(' ', $value) : $value);

        return $this->set($from, implode(' ', array_unique($value)));
    }
815510
private function _replace($from, $to) : array
    {
        $values = $this->getValues();
        foreach($values as $key => $value)
        {
            if ($value === $from)
            {
                $values[$key] = $to;
            }
        }
        return $values;
    }
1065760
private function substring($str, $from = 0, $to = FALSE)
    {
        if ($to !== FALSE) {
            if ($from == $to || ($from <= 0 && $to < 0)) {
                return '';
            }

            if ($from > $to) {
                $from_copy = $from;
                $from = $to;
                $to = $from_copy;
            }
        }

        if ($from < 0) {
            $from = 0;
        }

        $substring = ($to === FALSE) ? substr($str, $from) : substr($str, $from, $to - $from);
        return ($substring === FALSE) ? '' : $substring;
    }