application/Libraries/Core.php
/**
     * Method to Cast URL parameters to correct types
     * 
     * Allowed Types include: string, float, int, bool
     * is_numeric
     *  - int
     *  - float
     * else 
     *  - bool
     *  - string
     * 
     * @param array $arr Array containing default passedd parameters (as strings)
     * @return array $arr Array containing elements with correctly casted types
     */
Method to Cast URL parameters to correct types

Allowed Types include: string, float, int, bool
is_numeric
- int
- float
else
- bool
- string

@param array $arr Array containing default passedd parameters (as strings)
@return array $arr Array containing elements with correctly casted types
Method to Cast URL parameters to correct types Allowed Types include : string float int bool is_numeric - int - float else - bool - string @param array $arr Array containing default passedd parameters ( as strings ) @return array $arr Array containing elements with correctly casted types
private function castUrlParams(array $arr): array {
        foreach ($arr as $key => $value) {
            if(is_numeric($value)) {
                if(ctype_digit($value)) {
                   $arr[$key] = (int) $value;
                } else if(is_float($value+0)) {
                    $arr[$key] = (float) $value;
                }
            } else {
                if($value === 'true') {
                    $arr[$key] = true;
                }   else if($value === 'false') {
                    $arr[$key] = false;
                }   else {
                    $arr[$key] = (string) $value;
                }
            }
        }
        return $arr;
    }
private function castUrlParams ( array $ arr ) : array { foreach ( $ arr as $ key => $ value ) { if ( is_numeric ( $ value ) ) { if ( ctype_digit ( $ value ) ) { $ arr [ $ key ] = ( int ) $ value ; } else if ( is_float ( $ value + 0 ) ) { $ arr [ $ key ] = ( float ) $ value ; } } else { if ( $ value === 'true' ) { $ arr [ $ key ] = true ; } else if ( $ value === 'false' ) { $ arr [ $ key ] = false ; } else { $ arr [ $ key ] = ( string ) $ value ; } } } return $ arr ; }
Method to Cast URL parameters to correct types
Method to Cast URL parameters to correct types