Returns a **1** (true) or **0** (false) integer depending on the $value.

@param mixed $value

@return int
422372
public static function trueFalse($value)
    {
        if ((is_numeric($value) && $value > 0) || strtoupper($value) == 'Y') {
            return 1;
        }

        return filter_var($value, FILTER_VALIDATE_BOOLEAN) ? 1 : 0;
    }
32136
protected function checkType($value)
    {
        if ($value === null) {
            return $value;
        }

        Type::force($value, 'numeric', true);
        return $value === null ? $value : (float)$value;
    }
1007249
public static function integer($value) :int {
		if(strrpos($value, '.')) {
			$value = str_replace(',', '' , $value);
		}
		elseif(strrpos($value, ',')) {
			$value = str_replace('.', '' , $value);
		} 
		return(intval(preg_replace('/[^0-9.\-]/', '', str_replace(',', '.' , $value))));
	}
340694
public function countValue($value)
    {
        return count(array_filter($this->data, function ($item) use ($value) {
            return $value === $item;
        }));
    }
403819
protected function getBooleanCode($value)
    {
        if ($value && ('true' == $value || true === $value)) {
            return '1';
        } else {
            if ('false' == $value || false === $value) {
                return '0';
            }
        }

        return (bool) $value;
    }
126769
private function getNumericValue(string $value)
    {
        if (\strpos($value, '.') !== false) {
            return (float) $value;
        }

        return (int) $value;
    }
33192
public function get($value) {
        //TODO throw exception instead?!
        if (\is_int($value)) {
            $info = $this->getIndexAndMask($value);
            $i = $info["i"];
            $k = $info["k"];

            $flag = 1;
            $flag = $flag << $k;

            if (isset($this->array[$i])) return (($this->array[$i] & $flag) !== 0);
            return false;
        }
        return false;
    }
64259
private function castValue($value)
    {
        foreach ([
            // Integers
            '/^-?\d+$/' => function ($value) {
                return (int) $value;
            },
            // Floats
            '/^-?\d+\.\d+$/' => function ($value) {
                return (float) $value;
            },
            // Booleans
            '/^(?:true|false)$/' => function ($value) {
                return filter_var($value, \FILTER_VALIDATE_BOOLEAN);
            },
        ] as $format => $castFunction) {
            if (preg_match($format, $value)) {
                return $castFunction($value);
            }
        }

        return $value;
    }
1218529
protected function toInteger($value)
    {
        $numberValue = $this->toNumber($value);
        if (is_numeric($numberValue) && (int) $numberValue == $numberValue) {
            return (int) $numberValue; // cast to number
        }

        return $value;
    }
468576
private function getNumberValueOrNull($value)
    {
        if (!is_scalar($value) || is_bool($value) || (string) $value === '' || !is_numeric((string) $value)) {
            return null;
        }

        if ($this->isFloat() === true) {
            return is_float($value) ? $value : (float) $value;
        }

        return is_int($value) ? $value : (int) $value;
    }
1058684
private function parseValue($value) {
        if(is_numeric($value)) {
            return $value + 0;
        } elseif($value === "true") {
            return true;
        } elseif($value === "false") {
            return false;
        } elseif(is_array($value)) {
            return $value;
        }

        return addslashes(trim($value));
    }
416548
public static function isInteger($value)
    {
        if (!is_scalar($value) || is_float($value)) {
            return false;
        }
        if (is_int($value)) {
            return true;
        }

        return (bool)preg_match('/^-?[0-9]+$/', $value);
    }
262924
public function decode(string $value): ?int
    {
        $value = $this->hashids->decode($value);

        if (is_array($value) && sizeof($value) > 0) {
            return $value[0];
        } else {
            return null;
        }
    }
300804
protected function detectInt($value)
    {
        if ($value < 0) {
            // int
            if ($value >= self::INT8_MIN) {
                return self::BINN_INT8;
            } else if ($value >= self::INT16_MIN) {
                return self::BINN_INT16;
            } else if ($value >= self::INT32_MIN) {
                return self::BINN_INT32;
            } else {
                return self::BINN_INT64;
            }
        } else {
            // uint
            if ($value <= self::UINT8_MAX) {
                return self::BINN_UINT8;
            } else if ($value <= self::UINT16_MAX) {
                return self::BINN_UINT16;
            } else if ($value <= self::UINT32_MAX) {
                return self::BINN_UINT32;
            } else {
                return self::BINN_UINT64;
            }
        }
    }
1080327
public static function integer($value){

		$value = static::_nullValue($value);

		if($value !== null){

			$value = (int) $value;
		}

		return $value;
	}
447814
public function indexOfValue($value)
    {
        $name = $this->getNameByValue($value);
        if(!is_null($name))
        {
            return $this->indexOfKey($name);
        }
        return -1;
    }
628508
public static function arrayToInt($value=[])
    {
        if(!is_array($value) || count($value) == 0){
            return 0;
        }
        $nReturn = 0;
        foreach ($value as $item){
            if(($nReturn & $item) <= 0){
                $nReturn += $item;
            }
        }
        return $nReturn;
    }