src/Import_Command.php
private function create_author_mapping_file( $file, $author_data ) {

		if ( touch( $file ) ) {
			$author_mapping = array();
			foreach ( $author_data as $author ) {
				$author_mapping[] = array(
					'old_user_login' => $author->user_login,
					'new_user_login' => $this->suggest_user( $author->user_login, $author->user_email ),
				);
			}
			$file_resource = fopen( $file, 'w' );
			\WP_CLI\utils\write_csv( $file_resource, $author_mapping, array( 'old_user_login', 'new_user_login' ) );
			return new WP_Error( 'author-mapping-error', sprintf( 'Please update author mapping file before continuing: %s', $file ) );
		} else {
			return new WP_Error( 'author-mapping-error', "Couldn't create author mapping file." );
		}
	}
private function create_author_mapping_file( $file, $author_data ) {

		if ( touch( $file ) ) {
			$author_mapping = array();
			foreach ( $author_data as $author ) {
				$author_mapping[] = array(
					'old_user_login' => $author->user_login,
					'new_user_login' => $this->suggest_user( $author->user_login, $author->user_email ),
				);
			}
			$file_resource = fopen( $file, 'w' );
			\WP_CLI\utils\write_csv( $file_resource, $author_mapping, array( 'old_user_login', 'new_user_login' ) );
			return new WP_Error( 'author-mapping-error', sprintf( 'Please update author mapping file before continuing: %s', $file ) );
		} else {
			return new WP_Error( 'author-mapping-error', "Couldn't create author mapping file." );
		}
	}
private function create_author_mapping_file ( $ file , $ author_data ) { if ( touch ( $ file ) ) { $ author_mapping = array ( ) ; foreach ( $ author_data as $ author ) { $ author_mapping [ ] = array ( 'old_user_login' => $ author -> user_login , 'new_user_login' => $ this -> suggest_user ( $ author -> user_login , $ author -> user_email ) , ) ; } $ file_resource = fopen ( $ file , 'w' ) ; \ WP_CLI \ utils \ write_csv ( $ file_resource , $ author_mapping , array ( 'old_user_login' , 'new_user_login' ) ) ; return new WP_Error ( 'author-mapping-error' , sprintf ( 'Please update author mapping file before continuing: %s' , $ file ) ) ; } else { return new WP_Error ( 'author-mapping-error' , "Couldn't create author mapping file." ) ; } }
Creates an author mapping file, based on provided author data.

@return WP_Error      The file was just now created, so some action needs to be taken
Creates an author mapping file based on provided author data .