public static function separateRut(string $rut, bool $uppercase = true)
    {
        // Throw an exception if after cleaning the RUT we receive null, since
        // we cannot separate an empty string, thus making the resulting
        // array impossible to return. Also, it makes it catchable.
        if (empty($cleaned = self::cleanRut($rut, $uppercase))) {
            throw new InvalidRutException($rut);
        }

        $array = self::explodeByLastChar($cleaned);

        $array[0] = (int)$array[0];

        return $array;
    }
public static function separateRut(string $rut, bool $uppercase = true)
    {
        // Throw an exception if after cleaning the RUT we receive null, since
        // we cannot separate an empty string, thus making the resulting
        // array impossible to return. Also, it makes it catchable.
        if (empty($cleaned = self::cleanRut($rut, $uppercase))) {
            throw new InvalidRutException($rut);
        }

        $array = self::explodeByLastChar($cleaned);

        $array[0] = (int)$array[0];

        return $array;
    }
public static function separateRut ( string $ rut , bool $ uppercase = true ) { // Throw an exception if after cleaning the RUT we receive null, since // we cannot separate an empty string, thus making the resulting // array impossible to return. Also, it makes it catchable. if ( empty ( $ cleaned = self :: cleanRut ( $ rut , $ uppercase ) ) ) { throw new InvalidRutException ( $ rut ) ; } $ array = self :: explodeByLastChar ( $ cleaned ) ; $ array [ 0 ] = ( int ) $ array [ 0 ] ; return $ array ; }
Cleans a RUT from invalid characters and separates it

@param string $rut
@param bool $uppercase
@return array
@throws InvalidRutException
Cleans a RUT from invalid characters and separates it