You are here

protected function FetcherResult::checkFile in Feeds 8.3

Checks that a file exists and is readable.

Throws

\RuntimeException Thrown if the file isn't readable or writable.

2 calls to FetcherResult::checkFile()
FetcherResult::getFilePath in src/Result/FetcherResult.php
Returns the path to the file containing the file provided by the fetcher.
FetcherResult::getRaw in src/Result/FetcherResult.php
Returns the file provided by the fetcher as a string.

File

src/Result/FetcherResult.php, line 51

Class

FetcherResult
The default fetcher result object.

Namespace

Drupal\feeds\Result

Code

protected function checkFile() {
  if (!file_exists($this->filePath)) {
    throw new \RuntimeException(new FormattableMarkup('File %filepath does not exist.', [
      '%filepath' => $this->filePath,
    ]));
  }
  if (!is_readable($this->filePath)) {
    throw new \RuntimeException(new FormattableMarkup('File %filepath is not readable.', [
      '%filepath' => $this->filePath,
    ]));
  }
}