/** * Checks the given value * @param string $value * @return bool True if check was passed */ function Check($value) { if (!ctype_digit(String::TrimLeft($value, '-'))) { $this->error = self::HasNonDigits; } else { $floatValue = (double) $value; if ($floatValue < $this->min) { $this->error = self::ExceedsMin; } else { if ($floatValue > $this->max) { $this->error = self::ExceedsMax; } } } return $this->error == ''; }
/** * Adds given extension, leading dot is optional. * @param string $path * @param string $extension * @param bool $replaceExisting If true and extension exists, it is replaced. * @return string */ static function AddExtension($path, $extension, $replaceExisting = false) { $result = $path; if ($replaceExisting) { $result = self::RemoveExtension($path); } return join('.', array($result, System\String::TrimLeft($extension, '.'))); }