@param int|float $value
@param string    $inputUnit
@param string    $outputUnit

@return int
760606
protected function convertTimeUnit($value, $inputUnit, $outputUnit)
    {
        switch ($inputUnit) {
            case self::TIMEUNIT_MINUTE:
                $modifier = 60000000;
                break;
            case self::TIMEUNIT_SECOND:
                $modifier = 1000000;
                break;
            case self::TIMEUNIT_MILLISECOND:
                $modifier = 1000;
                break;
            case self::TIMEUNIT_MICROSECOND:
                $modifier = 1;
                break;
            default:
                throw new \InvalidArgumentException(
                    sprintf('Invalid input time unit \'%s\'', $inputUnit)
                );
        }

        switch ($outputUnit) {
            case self::TIMEUNIT_SECOND:
                $modifier /= 1000000;
                break;
            case self::TIMEUNIT_MILLISECOND:
                $modifier /= 1000;
                break;
            case self::TIMEUNIT_MICROSECOND:
                $modifier /= 1;
                break;
            default:
                throw new \InvalidArgumentException(
                    sprintf('Invalid output time unit \'%s\'', $outputUnit)
                );
        }

        return (int) ceil($value * $modifier);
    }
910022
protected function execute(InputInterface $input, OutputInterface $output): ?int
    {
        $username = $this->getUsername($input, $output);
        $user = $this->findUser($output, $username);
        if (null === $user) {
            return 1;
        }

        $password = $this->getPassword($input, $output);
        if ($password) {
            $this->userManager->setPlainTextPassword($user, $password);
        } else {
            $this->userManager->requestNewPassword($user);
        }
        $this->userManager->save($user);

        if ($password) {
            $message = $this->translator->trans(
                'user.password_changed_success',
                ['%username%' => $username],
                'security'
            );
        } else {
            $message = $this->translator->trans(
                'user.password_request_sent',
                ['%username%' => $username],
                'security'
            );
        }
        $output->writeln("<info>{$message}</info>");

        return 0;
    }
301149
public static function getInstance($value, $unit)
    {
        if (!array_key_exists($unit, self::UNIT)) {
            throw new InvalidArgumentException('Time unit "%s" is not recognized.', $unit);
        }
        $setter = 'set'.ucfirst($unit);

        return (new self)->$setter($value);
    }
161896
public function convert($value, $fromUnit, $toUnit) {
		$fromUnit = strtoupper($fromUnit);
		$toUnit = strtoupper($toUnit);

		if (!isset($this->_units[$fromUnit]) || !isset($this->_units[$toUnit])) {
			throw new CalculatorException('Invalid Unit');
		}

		if ($fromUnit === static::UNIT_MILES) {
			$value *= $this->_units[$toUnit];
		} elseif ($toUnit === static::UNIT_MILES) {
			$value /= $this->_units[$fromUnit];
		} else {
			$value /= $this->_units[$fromUnit];
			$value *= $this->_units[$toUnit];
		}
		return $value;
	}
548898
public function int($value)
    {
        if ($this->notBeEmpty($value)) {
            if (is_int($value)) {
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
    }
192971
public static function toInt($value)
    {
        if (!static::is($value)) {
            throw new \InvalidArgumentException(
                "The \$value parameter must be numeric (or string representing a big number)."
            );
        }

        if (is_int($value)) {
            return $value;
        } elseif (is_float($value)) {
            return (int)$value;
        }

        if (($decimal = Str::pos($value, '.')) !== false) {
            $value = Str::sub($value, 0, (int)$decimal);
        }

        return $value;
    }
704643
public function convertToDatabaseValue($value, AbstractPlatform $platform): int
    {
        \assert('is_int($value)');
        if (!isset($this->getValues()[$value])) {
            throw new \InvalidArgumentException('Invalid type.');
        }
        return $value;
    }
453324
protected function get_int_value( $value, $default, $setting ) {
		$default = (int) $default;
		if ( is_numeric( $value ) ) {
			$value = (int) $value;
			if ( $value !== $default ) {
				if ( isset( $setting['min'] ) && $value < (int) $setting['min'] ) {
					$value = (int) $setting['min'];
				}
				if ( isset( $setting['max'] ) && $value > (int) $setting['max'] ) {
					$value = (int) $setting['max'];
				}
			} elseif ( isset( $setting['option'] ) ) {
				$default = isset( $setting['option_default'] ) ? (int) $setting['option_default'] : $default;
				$value   = (int) $this->app->get_option( $setting['option'], $default );
			}
		} else {
			$value = $default;
		}

		return $value;
	}
388204
public static function convertInto(float $time, string $unit, string $destUnit)
    {
        if (!$time) {
            return 0;
        }

        self::validateUnit($unit);
        self::validateUnit($destUnit);

        $destMultiplier = self::$map[$destUnit];
        $sourceMultiplier = self::$map[$unit];

        $time = $destMultiplier / ($time * $sourceMultiplier);

        return $time;
    }
154157
public function getInt(string $key, int $defaultValue = 0): int
    {
        return intval($this->get($key, $defaultValue));
    }
667131
public function setUnit($unit, $value = null)
    {
        $unit = static::singularUnit($unit);
        $dateUnits = ['year', 'month', 'day'];
        if (in_array($unit, $dateUnits)) {
            return $this->setDate(...array_map(function ($name) use ($unit, $value) {
                return $name === $unit ? $value : $this->$name;
            }, $dateUnits));
        }

        $units = ['hour', 'minute', 'second', 'micro'];
        if ($unit === 'millisecond' || $unit === 'milli') {
            $value *= 1000;
            $unit = 'micro';
        } elseif ($unit === 'microsecond') {
            $unit = 'micro';
        }

        return $this->setTime(...array_map(function ($name) use ($unit, $value) {
            return $name === $unit ? $value : $this->$name;
        }, $units));
    }
1352423
public function subtract($unit, $value = 1, $overflow = null)
    {
        if (is_string($unit) && func_num_args() === 1) {
            $unit = CarbonInterval::make($unit);
        }

        return $this->sub($unit, $value, $overflow);
    }
500083
private function getDifference($value): ?int
    {
        // Let's prepare the dates...
        $now = (new \DateTime())->setTime(0, 0);
        $date = Date::getDateTime($value);

        // ...and make comparison with "day" as unit
        if ($date instanceof \DateTime) {
            return Date::getDateDifference($now, $date, Date::DATE_DIFFERENCE_UNIT_DAYS);
        }

        return null;
    }
238018
public function setValue($value)
    {
        if (is_int($value) || is_float($value)) {
            $this->value = $value;
        } else {
            $msg = "The value of a Weight must be a valid integer or float value, '" . gettype($value) . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }
827482
public static function float(&$value, $options = ['max'=>null, 'min'=>null, 'default'=>null])
    {
        $value = (float)$value;
        self::processNum($value, $options);
        return $value;
    }
726207
public function get($input_value, $input_format, $output_format = 'Y-m-d H:i:s')
    {
        $utc_offset = $this->dic['utc_offset'];

        if ($utc_offset == 0) {
            return $this->dic['datetimenow'];
        }

        $dt = Carbon::createFromFormat($input_format, $input_value);

        if ($utc_offset > 0) {
            $dt->subMinutes($utc_offset);
        } else {
            $dt->addMinutes($utc_offset);
        }

        return $dt->format($output_format);
    }
18991
public function output($inputName, $value = null, $options = array())
    {
        $view = View::getInstance();
        $view->requireAsset('core/colorpicker');
        $form = Loader::helper('form');
        $r = Request::getInstance();
        if ($r->request->has($inputName)) {
            $value = h($r->request->get($inputName));
        }
        $strOptions = '';
        $i = 0;
        $defaults = array();
        $defaults['value'] = $value;
        $defaults['className'] = 'ccm-widget-colorpicker';
        $defaults['showInitial'] = true;
        $defaults['showInput'] = true;
        $defaults['allowEmpty'] = true;
        $defaults['cancelText'] = t('Cancel');
        $defaults['chooseText'] = t('Choose');
        $defaults['preferredFormat'] = 'rgb';
        $defaults['showAlpha'] = false;
        $defaults['clearText'] = t('Clear Color Selection');
        $defaults['appendTo'] = '.ui-dialog';
        $strOptions = json_encode(array_merge($defaults, $options));

        $identifier = new \Concrete\Core\Utility\Service\Identifier();
        $identifier = $identifier->getString(32);

        echo "<input type=\"text\" data-color-picker=\"{$identifier}\" name=\"{$inputName}\" value=\"{$value}\" id=\"ccm-colorpicker-{$inputName}\" />";
        echo "<script type=\"text/javascript\">";
        echo "$(function () { $('[data-color-picker={$identifier}]').spectrum({$strOptions}); })";
        echo "</script>";
    }