public function checkCondition($value) { assert(is_string($value)); if (parent::checkCondition($value)) { return true; } elseif (preg_match($this->regex, $value) === 1) { return true; } return false; }
public function checkCondition($value) { assert(is_string($value) || is_float($value)); if (parent::checkCondition($value)) { return true; } preg_match('#^(?:-)?([0-9]+)\\.([0-9]+)$#', $value, $matches); $m = strlen($matches[1]); $n = strlen($matches[2]); if ($m + $n <= $this->maxPrecision && $n <= $this->maxScale) { return true; } return false; }
public function checkCondition($value) { assert(is_string($value) || is_bool($value) || is_int($value)); if (parent::checkCondition($value)) { return true; } elseif (is_bool($value)) { return true; } elseif (is_string($value)) { if (in_array(strtolower($value), array('true', 'false'))) { return true; } } elseif (is_int($value)) { if (in_array($value, array(0, 1))) { return true; } } return false; }
/** * Constructs a new none data format condition. */ public function __construct() { parent::__construct(true, true); }