src/Import_Command.php
private function process_author_mapping( $authors_arg, $author_data ) {

		// Provided an author mapping file (method checks validity)
		if ( file_exists( $authors_arg ) ) {
			return $this->read_author_mapping_file( $authors_arg );
		}

		// Provided a file reference, but the file doesn't yet exist
		if ( false !== stripos( $authors_arg, '.csv' ) ) {
			return $this->create_author_mapping_file( $authors_arg, $author_data );
		}

		switch ( $authors_arg ) {
			// Create authors if they don't yet exist; maybe match on email or user_login
			case 'create':
				return $this->create_authors_for_mapping( $author_data );

			// Skip any sort of author mapping
			case 'skip':
				return array();

			default:
				return new WP_Error( 'invalid-argument', "'authors' argument is invalid." );
		}
	}
private function process_author_mapping( $authors_arg, $author_data ) {

		// Provided an author mapping file (method checks validity)
		if ( file_exists( $authors_arg ) ) {
			return $this->read_author_mapping_file( $authors_arg );
		}

		// Provided a file reference, but the file doesn't yet exist
		if ( false !== stripos( $authors_arg, '.csv' ) ) {
			return $this->create_author_mapping_file( $authors_arg, $author_data );
		}

		switch ( $authors_arg ) {
			// Create authors if they don't yet exist; maybe match on email or user_login
			case 'create':
				return $this->create_authors_for_mapping( $author_data );

			// Skip any sort of author mapping
			case 'skip':
				return array();

			default:
				return new WP_Error( 'invalid-argument', "'authors' argument is invalid." );
		}
	}
private function process_author_mapping ( $ authors_arg , $ author_data ) { // Provided an author mapping file (method checks validity) if ( file_exists ( $ authors_arg ) ) { return $ this -> read_author_mapping_file ( $ authors_arg ) ; } // Provided a file reference, but the file doesn't yet exist if ( false !== stripos ( $ authors_arg , '.csv' ) ) { return $ this -> create_author_mapping_file ( $ authors_arg , $ author_data ) ; } switch ( $ authors_arg ) { // Create authors if they don't yet exist; maybe match on email or user_login case 'create' : return $ this -> create_authors_for_mapping ( $ author_data ) ; // Skip any sort of author mapping case 'skip' : return array ( ) ; default : return new WP_Error ( 'invalid-argument' , "'authors' argument is invalid." ) ; } }
Processes how the authors should be mapped

@param string            $authors_arg      The `--author` argument originally passed to command
@param array             $author_data      An array of WP_User-esque author objects
@return array|WP_Error   $author_mapping   Author mapping array if successful, WP_Error if something bad happened
Processes how the authors should be mapped