<?php
/**
* @package typehintclass
*/
/**
* Type hint class for all values that can be used as ints.
*/
final class Int implements TypeHint {
/**
* Type hint class, cannot be instantiated nor extended.
*/
private function __construct() { }
/**
* Indicates if this class represents a type hint for provided value.
* @param mixed $value The value.
* @return bool True if this class represents a type hint for that value.
*/
public static function isTypeHintFor($value) {
if (is_int($value)) {
return true;
} else if (is_string($value)) {
$temp = (int)$value;
$temp = (string)$temp;
return $value === $temp;
}
return false;
}
}
?>
|