PHPCS passing for abstract-wc-csv-exporter.php

This commit is contained in:
Gerhard Potgieter 2018-03-06 07:55:15 +02:00
parent 1c191688f8
commit 38892f3067
1 changed files with 7 additions and 8 deletions

View File

@ -74,7 +74,7 @@ abstract class WC_CSV_Exporter {
/**
* Prepare data that will be exported.
*/
abstract function prepare_data_to_export();
abstract public function prepare_data_to_export();
/**
* Return an array of supported column names and ids.
@ -171,7 +171,7 @@ abstract class WC_CSV_Exporter {
*/
public function send_headers() {
if ( function_exists( 'gc_enable' ) ) {
gc_enable();
gc_enable(); // phpcs:ignore PHPCompatibility.PHP.NewFunctions.gc_enableFound
}
if ( function_exists( 'apache_setenv' ) ) {
@apache_setenv( 'no-gzip', 1 ); // @codingStandardsIgnoreLine
@ -192,7 +192,6 @@ abstract class WC_CSV_Exporter {
* Set filename to export to.
*
* @param string $filename Filename to export to.
* @return string
*/
public function set_filename( $filename ) {
$this->filename = sanitize_file_name( str_replace( '.csv', '', $filename ) . '.csv' );
@ -236,7 +235,7 @@ abstract class WC_CSV_Exporter {
protected function export_column_headers() {
$columns = $this->get_column_names();
$export_row = array();
$buffer = fopen( 'php://output', 'w' );
$buffer = fopen( 'php://output', 'w' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fopen
ob_start();
foreach ( $columns as $column_id => $column_name ) {
@ -269,7 +268,7 @@ abstract class WC_CSV_Exporter {
*/
protected function export_rows() {
$data = $this->get_data_to_export();
$buffer = fopen( 'php://output', 'w' );
$buffer = fopen( 'php://output', 'w' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fopen
ob_start();
array_walk( $data, array( $this, 'export_row' ), $buffer );
@ -378,8 +377,8 @@ abstract class WC_CSV_Exporter {
$data = $data ? 1 : 0;
}
$use_mb = function_exists( 'mb_convert_encoding' );
$data = (string) urldecode( $data );
$use_mb = function_exists( 'mb_convert_encoding' );
$data = (string) urldecode( $data );
if ( $use_mb ) {
$encoding = mb_detect_encoding( $data, 'UTF-8, ISO-8859-1', true );
@ -448,7 +447,7 @@ abstract class WC_CSV_Exporter {
* @return string
*/
protected function implode_values( $values ) {
$values_to_implode = array();
$values_to_implode = array();
foreach ( $values as $value ) {
$value = (string) is_scalar( $value ) ? $value : '';