Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. HttpFactory.php

function HttpFactory::createStreamFromFile

Overrides StreamFactoryInterface::createStreamFromFile

File

vendor/guzzlehttp/psr7/src/HttpFactory.php, line 47

Class

HttpFactory
Implements all of the PSR-17 interfaces.

Namespace

GuzzleHttp\Psr7

Code

public function createStreamFromFile(string $file, string $mode = 'r') : StreamInterface {
    try {
        $resource = Utils::tryFopen($file, $mode);
    } catch (\RuntimeException $e) {
        if ('' === $mode || false === \in_array($mode[0], [
            'r',
            'w',
            'a',
            'x',
            'c',
        ], true)) {
            throw new \InvalidArgumentException(sprintf('Invalid file opening mode "%s"', $mode), 0, $e);
        }
        throw $e;
    }
    return Utils::streamFor($resource);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal