Casts the value into an integer.

@return integer
429966
public function castInteger()
    {
        $castFunction = function ($value) {
            return is_object($value) ? 1 : (int) $value;
        };

        if (is_numeric($this->value)) {
            return $castFunction($this->value);
        }

        return $this->handleMismatch($castFunction, 'integer');
    }
1157521
public static Integer toInt(Object value, Integer defaultValue) {
		return convert(Integer.class, value, defaultValue);
	}
427788
public static final Integer getInteger(Number value)
   {
      Integer result = null;
      if (value != null)
      {
         if (value instanceof Integer)
         {
            result = (Integer) value;
         }
         else
         {
            result = Integer.valueOf((int) Math.round(value.doubleValue()));
         }
      }
      return (result);
   }
416300
public function count()
    {
        if(is_null($this->int_count)){
            $this->int_count = mb_strlen($this->value, C::ENCODING);
        }

        return $this->int_count;
    }
1167737
protected function castValue($cast, $value)
    {
        switch ($cast) {
            case 'integer';
                $value = (integer) $value;
                break;
            case 'boolean';
                $value = in_array($value, array('true', 't', 'yes', 'y'));
                break;
            case 'string':
            default:
                $value = (string) $value;
        }

        return $value;
    }
604407
public function readInt() {
            
            $int = $this->readU29();
            // if int and has the sign bit set
            // Check if the integer is an int
            // and is signed
            if (($int & 0x18000000) == 0x18000000) {
                $int ^= 0x1fffffff;
                $int *= -1;
                $int -= 1;
            } else if (($int & 0x10000000) == 0x10000000) {
                // remove the signed flag
                $int &= 0x0fffffff;
            }

            return $int;

        }
914465
public function castBoolean()
    {
        if (is_bool($this->value)) {
            return $this->value;
        }

        foreach ($this->trueValues as $true) {
            if ($this->value === $true) {
                return true;
            }
        }

        foreach ($this->falseValues as $false) {
            if ($this->value === $false) {
                return false;
            }
        }

        $castFunction = function ($value) {
            return (bool) $value;
        };

        return $this->handleMismatch($castFunction, 'boolean');
    }
993082
public function int()
    {
        return $this->markErrorIf(!is_numeric($this->value) || strval(intval($this->value)) != strval($this->value) );
    }
176437
def _cast(self, value):
        
        if value.isdigit():
            value = int(value)
        elif re.compile("^\d+\.\d+").match(value):
            value = float(value)
        return value
890135
private static Integer[] castToInteger( int[] d )
    {
        Integer[] dest = new Integer[d.length];
        for ( int i = 0; i < d.length; i++ )
        {
            dest[i] = d[i];
        }
        return dest;
    }
1085458
public function toMicro()
    {
        $inner = $this->getAttribute("amount", false); //cast=false
        $decimals = $this->getDivisibility();

        if (is_integer($inner)) {
            $attrib = $inner;
        }
        elseif (is_float($inner)) {
            // we want only integer!
            $attrib = $inner * pow(10, $decimals);
        }
        elseif (is_string($inner)) {
            // parse number string representation. Parsing to float.
            $isFloat = false !== strpos($inner, ".");
            $number = $isFloat ? (float) $inner : (int) $inner;
            $multi  = $isFloat ? pow(10, $decimals) : 1;
            $attrib = $number * $multi;
        }
        elseif (is_array($inner)) {
            // try to read first value of array
            $attrib = array_shift($inner);
        }
        else {
            $attrib = (int) $inner;
        }

        $this->micro = (int) $attrib;
        if ($this->micro < 0)
            // not allowed: 0 in micro XEM is the minimum possible value!
            $this->micro = 0;

        return $this->micro;
    }
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;
    }
851988
public static function ToInteger( $value, $provider = null )
	{
		if ( $value instanceof Integer)
		{
			return $value;
		}

		if ( is_int( $value ) )
		{
			$int = $value;
		}
		else
		{
			$int = Convert::ToDouble( $value, $provider );
			if ( is_null( $int ) ) throw new InvalidCastException("Unable to convert value '$value' to type Integer" );
		}

		return Integer::FromValue( $int );
	}
1201042
public int toInteger(Object val) {
    if (val == null) {
      return 0;
    }
    else if (val instanceof Double) {
      if (!Double.isNaN(((Double) val).doubleValue())) {
        return 0;
      }
      else {
        return ((Double) val).intValue();
      }
    }
    else if (val instanceof Number) {
      return ((Number) val).intValue();
    }
    else if (val instanceof String) {
      if ("".equals(val)) {
        return 0;
      }
      return Integer.parseInt((String) val);
    }
    else if (val instanceof Boolean) {
      return ((Boolean) val).booleanValue() ? 1 : 0;
    }
    else if (val instanceof Character) {
      return ((Character) val).charValue();
    }

    throw new ArithmeticException("Integer coercion: " + val.getClass().getName() + ":(" + val + ")");
  }
385577
public function getInt()
    {
        $r = $this->getRedValue();
        $g = $this->getGreenValue();
        $b = $this->getBlueValue();
        $a = (int) round($this->getAlphaValue() * 255);

        return (int) (($a << 24) + ($r << 16) + ($g << 8) + $b);
    }
363980
function castInts() {
		foreach (static::$_columns as $column_name => &$type) {
			if ($this->{$column_name} === null || !static::isIntegerType($type)) {
				continue;
			}
			if ('' === $this->{$column_name}) {
				$this->{$column_name} = null;
				continue;
			}
			$this->{$column_name} = (int) $this->{$column_name};
		}
		return $this;
	}
1080250
protected function castToInt($value, bool $nullable = true)
    {
        if (null === $value && $nullable) {
            return null;
        }

        return (int) $value;
    }