/**
	 * Checks if a value contains a number.
	 *
	 * This method checks whether the specified number is an representative of a decimal
	 * A string is a valid decimal if it contains: Adittional +/-, one or more chars with a value
	 * between 0 and 9, another addtional part starting with a dot (not a comma!) and followed by
	 * one or more chars with a value between 0 and 9.
	 *
	 * Note: To check if a value contains numeric chars/digits only, see DefaultValidator::digit().
	 *
	 * Note: As this only accepts a dot as decimal separator you should use the filter "float"
	 * (Defaultfilter::float()) before.
	 *
	 * @see Number::isDecimal()
	 * @param mixed Value to check
	 * @return boolean
	 */
	public static function numeric($value, $optional) {
		if (Numbers::isDecimal($value) == true) {
			return true;
		}
		else {
			self::setError(self::ERROR_NUMERIC);
			return false;
		}
	}
예제 #2
0
	/**
	 * @dataProvider providerIsDecimal
	 */
	public function testIsDecimal($value, $expected) {
		$result = Numbers::isDecimal($value);
		$this->assertEquals($expected, $result, "Given: {$value}; Result: ".var_export($result, true));
	}