columns ) || ! is_array( $this->columns ) ) { return; } // Juggle original columns array $columns = $this->columns; $this->columns = array(); // Loop through columns and create objects from them foreach ( $columns as $column ) { if ( is_array( $column ) ) { $this->columns[] = new Column( $column ); } elseif ( $column instanceof Column ) { $this->columns[] = $column; } } } /** * Return the schema in string form. * * @since 1.0.0 * * @return string Calls get_create_string() on every column. */ protected function to_string() { // Default return value $retval = ''; // Bail if no columns to convert if ( empty( $this->columns ) ) { return $retval; } // Loop through columns... foreach ( $this->columns as $column_info ) { if ( method_exists( $column_info, 'get_create_string' ) ) { $retval .= '\n' . $column_info->get_create_string() . ', '; } } // Return the string return $retval; } }