You are here

public function RawFetcherResult::getFilePath in Feeds 8.3

Returns the path to the file containing the file provided by the fetcher.

When it comes to preference and efficiency, this method should be used whenever possible by parsers so that they do not have to load the entire file into memory.

Return value

string A path to a file containing the raw content of a feed.

Throws

\RuntimeException Thrown if an unexpected problem occurred usually regarding file handling.

Overrides FetcherResult::getFilePath

File

src/Result/RawFetcherResult.php, line 57

Class

RawFetcherResult
A fetcher result object that accepts a raw string.

Namespace

Drupal\feeds\Result

Code

public function getFilePath() {

  // Write to a temporary file if the parser expects a file.
  if ($this->filePath) {
    return $this->filePath;
  }
  $this->filePath = $this->fileSystem
    ->tempnam('temporary://', 'feeds-raw');
  file_put_contents($this->filePath, $this
    ->getRaw());
  return $this->filePath;
}