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

Breadcrumb

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

function JsonFile::__construct

Initializes json file reader/parser.

Parameters

string $path path to a lockfile:

?HttpDownloader $httpDownloader required for loading http/https json files:

?IOInterface $io:

Throws

\InvalidArgumentException

File

vendor/composer/composer/src/Composer/Json/JsonFile.php, line 66

Class

JsonFile
Reads/writes json files.

Namespace

Composer\Json

Code

public function __construct(string $path, ?HttpDownloader $httpDownloader = null, ?IOInterface $io = null) {
    $this->path = $path;
    if (null === $httpDownloader && Preg::isMatch('{^https?://}i', $path)) {
        throw new \InvalidArgumentException('http urls require a HttpDownloader instance to be passed');
    }
    $this->httpDownloader = $httpDownloader;
    $this->io = $io;
}
RSS feed
Powered by Drupal