Set real boolean type
@param string $val String value
@return bool Conversion value
506616
private function setRealBoolean(string $val):bool
    {
        if ($val === "true") {
            $val = true;
        } else {
            $val = false;
        }
        return ($val);
    }
556984
public function is_bool($bValue)
    {
        $this->set_message('is_bool', lang('fv_is_bool_field'));
        return is_bool($bValue) || $bValue === '1' || $bValue === '0' || $bValue === 1 || $bValue === 0;
    }
796208
public static function arrList($val): bool
    {
        if (!$val || !\is_array($val)) {
            return false;
        }

        /** @var array $val */
        foreach ($val as $k => $v) {
            if (!\is_array($v)) {
                return false;
            }
        }

        return true;
    }
951211
public function isSelected($val)
    {
        if ($this->isMulti()) {
            return in_array($val, $this->getValue());
        } else {
            return $val === $this->getValue();
        }
    }
504928
public function setCreated($val)
	{
		if (($val instanceof \DateTime)) {
			$this->created = $val;
		}
		else if (is_string($val) && !empty($val)) {
			try {
				// There can be accidentaly exeption thrown whenever the given
				// string is not valid date.
				$this->created = new \DateTime($val);
			} catch(\Exception $e) {
				$this->created = null;
			}
		}
		else {
			$this->created = null;
		}

		return $this;
	}
119234
protected function realToBinary($val)
    {
        $bdata = self::typeBytes("2", 3); // 2 is 0010, type indicator for reals
        return $bdata.strrev(pack("d", (float)$val));
    }
1223169
public static boolean toBoolean(Object val)
    {
        for (;;) {
            if (val instanceof Boolean)
                return ((Boolean) val).booleanValue();
            if (val == null || val == Undefined.instance)
                return false;
            if (val instanceof CharSequence)
                return ((CharSequence) val).length() != 0;
            if (val instanceof Number) {
                double d = ((Number) val).doubleValue();
                return (d == d && d != 0.0);
            }
            if (val instanceof Scriptable) {
                if (val instanceof ScriptableObject &&
                    ((ScriptableObject) val).avoidObjectDetection())
                {
                    return false;
                }
                if (Context.getContext().isVersionECMA1()) {
                    // pure ECMA
                    return true;
                }
                // ECMA extension
                val = ((Scriptable) val).getDefaultValue(BooleanClass);
                if ((val instanceof Scriptable) && !isSymbol(val))
                    throw errorWithClassName("msg.primitive.expected", val);
                continue;
            }
            warnAboutNonJSObject(val);
            return true;
        }
    }
200631
protected function validate_point($val) {
        if (empty($val)) {
            return false;
        }
        $maxgrade = (int)get_config('core', 'gradepointmax');
        $isintlike = ((string)(int)$val === $val) ? true : false;
        return ($isintlike === true && $val > 0 && $val <= $maxgrade) ? true : false;
    }
1011187
protected function Mod( $val )
	{
		$val = $this->getOtherValue( $val );

		if ( is_infinite( $this->_value ) || is_nan( $this->_value ) || is_nan( $val ) || $val == 0 )
		{
			return new FloatProxy( NAN );
		}

		if ( is_infinite( $val ) )
		{
			return $this;
		}

		if ( is_infinite( $val ) )
		{
			return $val;
		}

		if ( $this->_value == 0 )
		{
			return $this;
		}

		$denominator = DecimalValue::FromFloat( $val );
		$result = DecimalValue::FromFloat( $this->_value )->Mod( $denominator );
		$result = $result->ToFloat( null );
		return new FloatProxy( $result );
	}
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;
    }
1316614
public function setSize($val)
    {
        if (in_array($val, $this->bootstrapSizesAllowed) === false && is_null($val) === false){
            throw new \Lucid\Html\Exception\InvalidAttributeValue($this->instantiatorName, 'size', $val,  $this->bootstrapSizesAllowed);
        }

        $classesToRemove = [];
        foreach ($this->bootstrapSizesAllowed as $size) {
            $classesToRemove[] = $this->bootstrapSizePrefix.'-'.$size;
        }
        $this->removeClass($classesToRemove);

        if (is_null($val) === true) {
            return $this;
        } else {
            $this->addClass($this->bootstrapSizePrefix.'-'.$val);
            return $this;
        }
    }
1050059
function value($type,$val) {
		switch ($type) {
			case self::PARAM_FLOAT:
				if (!is_string($val))
					$val=str_replace(',','.',$val);
				return $val;
			case \PDO::PARAM_NULL:
				return NULL;
			case \PDO::PARAM_INT:
				return (int)$val;
			case \PDO::PARAM_BOOL:
				return (bool)$val;
			case \PDO::PARAM_STR:
				return (string)$val;
			case \PDO::PARAM_LOB:
				return (binary)$val;
		}
	}
1122942
protected function IDiv($val)
	{
		return Integer::FromValue( floor( $this->_value->getValue() / Convert::ToInt64( $val->getValue()->getValue() ) ) );
	}
912419
protected function TryGt( $val, &$res )
	{
		$res = false;
		if ( ! $val instanceof ValueProxy ) return false;
		if ( $val->GetValueCode() != $this->GetValueCode() ) return false;

		$res = $this->Gt( $val );
		return true; // This SHOULD return true to indicate the comparison was successful
	}
645416
protected function Eq( $val )
	{
		$result = $this->_value == $val->getValue();

		if ( $result ||
			 is_infinite( $this->_value ) ||
			 is_nan( $this->_value ) ||
			 is_infinite( $val->getValue() ) ||
			 is_nan( $val->getValue() ) )
		{
			return $result;
		}

		$a = $this->_value;
		$b = $val->getValue();
		$limit = pow( 2, 31 );

		if ( abs( $a ) < $limit && abs( $b ) < $limit )
		{
			return $a == $b;
		}

		$expectedDecimal = DecimalValue::FromFloat( $a, false );
		$actualDecimal   = DecimalValue::FromFloat( $b, false );

		$expectedDecimalLength = $expectedDecimal->getIsDecimal() ? strlen( $expectedDecimal->getDecimalPart() ) : 0;
		$actualDecimalLength = $actualDecimal->getIsDecimal() ? strlen( $actualDecimal->getDecimalPart() ) : 0;

		$expectedDigitsLength = strlen( $expectedDecimal->getIntegerPart() );
		$actualDigitsLength = strlen( $actualDecimal->getIntegerPart() );

		// Make sure they have the same number of decimals
		if ( $expectedDecimalLength != $actualDecimalLength )
		{
			if ( $expectedDecimalLength > $actualDecimalLength )
			{
				$expectedDecimal = $expectedDecimal->getRound( $actualDecimalLength );
			}
			else
			{
				$actualDecimal = $actualDecimal->getRound( $expectedDecimalLength );
			}
		}

		if ( ! $expectedDecimal->getIsDecimal() && $expectedDigitsLength == $actualDigitsLength )
		{
			// Make sure they are the same length after removing trailing zeros. This will required when
			// the values are say 1.23E6 (which will be decimal 123000) and 1.234E6 (123400).  OK these are
			// simplified examples.  A concrete example is 1.234567890123456E38 and 1.2345678901235E38
			$expectedDigits = rtrim( $expectedDecimal->getIntegerPart(), "0" );
			if ( strlen( $expectedDigits ) == 0 ) $expectedDigits = "0";
			$actualDigits = rtrim( $actualDecimal->getIntegerPart(), "0" );
			if ( strlen( $actualDigits ) == 0 ) $actualDigits = "0";

			if ( strlen( $expectedDigits ) > strlen( $actualDigits ) )
			{
				$expectedDecimal = DecimalValue::FromValue( $expectedDigits )->getRound( strlen( $actualDigits ) - strlen( $expectedDigits ) );
				$factor = DecimalValue::FromValue( 10 )->Pow( $actualDigitsLength - strlen( $expectedDigits ) );
				$expectedDecimal = $expectedDecimal->Mul( $factor );
			}
			else if ( strlen( $expectedDigits ) < strlen( $actualDigits ) )
			{
				$actualDecimal = DecimalValue::FromValue( $actualDigits )->getRound( strlen( $expectedDigits ) - strlen( $actualDigits ), PHP_ROUND_HALF_DOWN );
				$factor = DecimalValue::FromValue( 10 )->Pow( $expectedDigitsLength - strlen( $actualDigits ) );
				$actualDecimal = $actualDecimal->Mul( $factor );
			}
		}
		else
		{
			// If the digits are not the same length ???
		}

		$result = $expectedDecimal->Equals( $actualDecimal );

		return $result;
	}
1306713
public function mimeType($type, $val = '')
    {
        if (is_array($type)) {
            $this->mimeType = array_merge($this->mimeType, $type);
        } else {
            $this->mimeType[$type] = $val;
        }
    }
587984
function toBoolean(val, def) {
    if (is_1.isBoolean(val))
        return val;
    if (!is_1.isValue(val))
        return toDefault(null, def);
    val = val.toString();
    return (parseFloat(val) > 0 ||
        is_1.isInfinite(val) ||
        val === 'true' ||
        val === 'yes' ||
        val === '1' ||
        val === '+');
}