Determines whether a given value is a valid scale selection.

@param string|int $val The value to test.
@return bool Valid or invalid
773034
protected function validate_scale($val) {
        global $COURSE;
        $scales = get_scales_menu($COURSE->id);
        return (!empty($val) && isset($scales[(int)$val])) ? true : false;
    }
391501
public static function isValid($price)
    {
        //====================================================================//
        // Check Contents Available
        if (!is_array($price) && !($price instanceof ArrayObject)) {
            return false;
        }
        /** @var array|ArrayObject $price */
        if (!isset($price["base"])) {
            return false;
        }
        if (!isset($price["ht"]) || !isset($price["ttc"]) || !isset($price["vat"])) {
            return false;
        }
        if (!self::isValidAmount($price)) {
            return false;
        }
        if (!self::isValidCurrency($price)) {
            return false;
        }

        return true;
    }
785074
public function isValid ($value)
    {
        if (!is_numeric($value)) {
            $this->error(self::INVALID);
            return false;
        }

        if (!preg_match('/^-?[0-9]+([.,][0-9]+)?$/', $value)) {
            $this->error(self::INVALID);
            return false;
        }

        return true;
    }
1296750
public function _validation_numeric_max($val, $max_val)
	{
		return $this->_empty($val) || floatval($val) <= floatval($max_val);
	}
96204
public function isValueValid($value) {
		return $value instanceof DataType\NumberType || $value instanceof Type\QuantitativeValue || $value instanceof DataType\TextType;
	}
711071
public function validate($value)
    {
        if (!is_numeric($value)) {
            return false;
        }

        return $value / $this->number == round($value / $this->number);
    }
1194588
protected function Eq( $val )
	{
		if ( ! $val instanceof BoolProxy ) return false;
		return  ( $this->_value instanceof CoreFuncs::$False && $val->getValue() instanceof CoreFuncs::$False ) ||
				( $this->_value instanceof CoreFuncs::$True && $val->getValue() instanceof CoreFuncs::$True ) ||
				( is_bool( $this->_value ) && is_bool( $val->getValue() ) && $this->_value == $val->getValue() );
		// return $this->_value == (bool)$val->_value;
	}
955368
public function isValid($value)
    {
        $valueString = (string) $value;

        $this->_setValue($valueString);

        try {
            if (!Zend_Locale_Format::isFloat($value, array('locale' => $this->_locale))) {
                $this->_error();
                return false;
            }
        } catch (Zend_Locale_Exception $e) {
            $this->_error();
            return false;
        }

        return true;
    }
1262671
public function isValid($value)
    {
        if (!is_numeric($value)) {
            $this->_error(self::INVALID);
            return false;
        }

        $this->_setValue($value);
        $value = (float) $value;
        if ($value < 0 || $value > 1) {
            $this->_error(self::NOT_VALID);
            return false;
        }

        return true;
    }
132530
public function isValid($value)
    {
        if (!is_null($value) && !is_string($value) && !is_int($value) && !is_float($value) &&
            !is_bool($value) && !is_array($value)) {
            $this->_error(self::INVALID);
            return false;
        }
        if (is_string($value) && (('' === $value) || preg_match('/^\s+$/s', $value))) {
            $this->_error(self::INVALID);
            return false;
        } elseif (is_int($value) && (0 === $value)) {
            return true;
        } elseif (!is_string($value) && empty($value)) {
            $this->_error(self::INVALID);
            return false;
        }
        return true;
    }
492831
public function set($val)
    {
        $code = $this->get($val);

        if ($code) {
            $this->current[] = $code;

            return true;
        }

        return false;
    }
128068
public static function isSelfDescribing($val = null)
    {
        if (is_null($val)) {
            return null;
        }
        $val = (string) $val;
        for ($i=0; $i<strlen($val); $i++) {
            $_val   = $val{$i};
            $occ    = substr_count($val, $i);
            if ($_val != $occ) {
                return false;
            }
        }
        return true;
    }
786816
public function isValueValidType($value)
    {
        switch ($this->getType()) {
            case self::TYPE_BOOLEAN:
                $isValid = is_bool($value);
                break;
            case self::TYPE_DATE:
            case self::TYPE_DATETIME:
                $isValid = is_object($value) and get_class($value) == 'DateTime';
                break;
            case self::TYPE_NUMBER:
                $isValid = is_numeric($value);
                break;
            case self::TYPE_STRING:
                $isValid = is_string($value);
                break;
            default:
                $isValid = false;
        }

        return $isValid;
    }
197087
public static function isList($val): bool
    {
        if (!\is_array($val) || !isset($val[0])) {
            return false;
        }

        /** @var array $val */
        $keys = \array_keys($val);

        return \array_keys($keys) === $keys;
    }
127199
public static function alphaDash($val): bool
    {
        if (!\is_string($val) && !\is_numeric($val)) {
            return false;
        }

        return 1 === \preg_match('/^(?:[\w-]+)$/', $val);
    }
243260
public function _validation_numeric_min($val, $min_val)
	{
		return $this->_empty($val) || floatval($val) >= floatval($min_val);
	}
929994
public function isValid($value)
    {
        if ('mixed' === $this->type) {
            return true;
        }

        static $functionMap = array(
            'array'    => 'is_array',
            'bool'     => 'is_bool',
            'boolean'  => 'is_bool',
            'double'   => 'is_float',
            'float'    => 'is_float',
            'int'      => 'is_int',
            'integer'  => 'is_int',
            'null'     => 'is_null',
            'numeric'  => 'is_numeric',
            'object'   => 'is_object',
            'resource' => 'is_resource',
            'scalar'   => 'is_scalar',
            'string'   => 'is_string',
        );

        if (array_key_exists($this->type, $functionMap)) {
            $function = $functionMap[$this->type];

            return $function($value);
        }

        if (is_object($value)) {
            return ($value instanceof $this->type);
        }

        return false;
    }