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\JsonCode
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;
}