src/WPametu/DB/Column.php
public static function filter($column){
        $column = wp_parse_args($column, [
            'type' => '',
            'null' => false,
        ]);
        // Type required.
        if( !self::exists($column['type']) ){
            throw new \Exception('You must properly specify the data type of column.');
        }
        // Check varchar length
        if( self::is_length_required($column['type']) && !isset($column['length']) ){
            throw new \Exception(sprintf('Column %s requires length property.', $column['type']));
        }
        // Signed or Unsigned?
        if( self::is_numeric($column['type']) ){
            $column['signed'] = isset($column['signed']) ? (bool)$column['signed'] : true;
        }
        // If decimal, test_required params
        if( $column['type'] == self::DECIMAL ){
            if( !isset($column['max_digit'], $column['float']) ){
                throw new \Exception(sprintf('Column %s requires max_digit and float property.', self::DECIMAL));
            }
        }
        // If enum or set, test required properties.
        if( self::is_set($column['type']) && ( !is_array($column['values']) || empty($column['values']) ) ){
            throw new \Exception(sprintf('Column %s requires values property as array.', $column['type']));
        }
        return $column;
    }
public static function filter($column){
        $column = wp_parse_args($column, [
            'type' => '',
            'null' => false,
        ]);
        // Type required.
        if( !self::exists($column['type']) ){
            throw new \Exception('You must properly specify the data type of column.');
        }
        // Check varchar length
        if( self::is_length_required($column['type']) && !isset($column['length']) ){
            throw new \Exception(sprintf('Column %s requires length property.', $column['type']));
        }
        // Signed or Unsigned?
        if( self::is_numeric($column['type']) ){
            $column['signed'] = isset($column['signed']) ? (bool)$column['signed'] : true;
        }
        // If decimal, test_required params
        if( $column['type'] == self::DECIMAL ){
            if( !isset($column['max_digit'], $column['float']) ){
                throw new \Exception(sprintf('Column %s requires max_digit and float property.', self::DECIMAL));
            }
        }
        // If enum or set, test required properties.
        if( self::is_set($column['type']) && ( !is_array($column['values']) || empty($column['values']) ) ){
            throw new \Exception(sprintf('Column %s requires values property as array.', $column['type']));
        }
        return $column;
    }
public static function filter ( $ column ) { $ column = wp_parse_args ( $ column , [ 'type' => '' , 'null' => false , ] ) ; // Type required. if ( ! self :: exists ( $ column [ 'type' ] ) ) { throw new \ Exception ( 'You must properly specify the data type of column.' ) ; } // Check varchar length if ( self :: is_length_required ( $ column [ 'type' ] ) && ! isset ( $ column [ 'length' ] ) ) { throw new \ Exception ( sprintf ( 'Column %s requires length property.' , $ column [ 'type' ] ) ) ; } // Signed or Unsigned? if ( self :: is_numeric ( $ column [ 'type' ] ) ) { $ column [ 'signed' ] = isset ( $ column [ 'signed' ] ) ? ( bool ) $ column [ 'signed' ] : true ; } // If decimal, test_required params if ( $ column [ 'type' ] == self :: DECIMAL ) { if ( ! isset ( $ column [ 'max_digit' ] , $ column [ 'float' ] ) ) { throw new \ Exception ( sprintf ( 'Column %s requires max_digit and float property.' , self :: DECIMAL ) ) ; } } // If enum or set, test required properties. if ( self :: is_set ( $ column [ 'type' ] ) && ( ! is_array ( $ column [ 'values' ] ) || empty ( $ column [ 'values' ] ) ) ) { throw new \ Exception ( sprintf ( 'Column %s requires values property as array.' , $ column [ 'type' ] ) ) ; } return $ column ; }
Filter column array

@param array $column
@return array
@throws \Exception
Filter column array