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

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

        return $value;
    }
protected function toInteger ( $ value ) { $ numberValue = $ this -> toNumber ( $ value ) ; if ( is_numeric ( $ numberValue ) && ( int ) $ numberValue == $ numberValue ) { return ( int ) $ numberValue ; // cast to number } return $ value ; }
Converts a value to an integer. For example, "4" becomes 4.

@param mixed $value

@return int|mixed
Converts a value to an integer . For example 4 becomes 4 .