src/MakePotCommand.php
protected static function get_file_data( $file, $headers ) {
		// We don't need to write to the file, so just open for reading.
		$fp = fopen( $file, 'rb' );

		// Pull only the first 8kiB of the file in.
		$file_data = fread( $fp, 8192 );

		// PHP will close file handle, but we are good citizens.
		fclose( $fp );

		// Make sure we catch CR-only line endings.
		$file_data = str_replace( "\r", "\n", $file_data );

		return static::get_file_data_from_string( $file_data, $headers );
	}
protected static function get_file_data( $file, $headers ) {
		// We don't need to write to the file, so just open for reading.
		$fp = fopen( $file, 'rb' );

		// Pull only the first 8kiB of the file in.
		$file_data = fread( $fp, 8192 );

		// PHP will close file handle, but we are good citizens.
		fclose( $fp );

		// Make sure we catch CR-only line endings.
		$file_data = str_replace( "\r", "\n", $file_data );

		return static::get_file_data_from_string( $file_data, $headers );
	}
Retrieves metadata from a file.

Searches for metadata in the first 8kiB of a file, such as a plugin or theme.
Each piece of metadata must be on its own line. Fields can not span multiple
lines, the value will get cut at the end of the first line.

If the file data is not within that first 8kiB, then the author should correct
their plugin file and move the data headers to the top.

@see get_file_data()

@param string $file Path to the file.
@param array $headers List of headers, in the format array('HeaderKey' => 'Header Name').

@return array Array of file headers in `HeaderKey => Header Value` format.