parent
803e4e5dbd
commit
855473148a
|
@ -13,6 +13,7 @@
|
||||||
namespace Composer\Json;
|
namespace Composer\Json;
|
||||||
|
|
||||||
use Composer\Pcre\Preg;
|
use Composer\Pcre\Preg;
|
||||||
|
use Composer\Util\Filesystem;
|
||||||
use JsonSchema\Validator;
|
use JsonSchema\Validator;
|
||||||
use Seld\JsonLint\JsonParser;
|
use Seld\JsonLint\JsonParser;
|
||||||
use Seld\JsonLint\ParsingException;
|
use Seld\JsonLint\ParsingException;
|
||||||
|
@ -93,7 +94,7 @@ class JsonFile
|
||||||
if ($this->httpDownloader) {
|
if ($this->httpDownloader) {
|
||||||
$json = $this->httpDownloader->get($this->path)->getBody();
|
$json = $this->httpDownloader->get($this->path)->getBody();
|
||||||
} else {
|
} else {
|
||||||
if (!is_readable($this->path)) {
|
if (!Filesystem::isReadable($this->path)) {
|
||||||
throw new \RuntimeException('The file "'.$this->path.'" is not readable.');
|
throw new \RuntimeException('The file "'.$this->path.'" is not readable.');
|
||||||
}
|
}
|
||||||
if ($this->io && $this->io->isDebug()) {
|
if ($this->io && $this->io->isDebug()) {
|
||||||
|
@ -193,7 +194,7 @@ class JsonFile
|
||||||
*/
|
*/
|
||||||
public function validateSchema(int $schema = self::STRICT_SCHEMA, ?string $schemaFile = null): bool
|
public function validateSchema(int $schema = self::STRICT_SCHEMA, ?string $schemaFile = null): bool
|
||||||
{
|
{
|
||||||
if (!is_readable($this->path)) {
|
if (!Filesystem::isReadable($this->path)) {
|
||||||
throw new \RuntimeException('The file "'.$this->path.'" is not readable.');
|
throw new \RuntimeException('The file "'.$this->path.'" is not readable.');
|
||||||
}
|
}
|
||||||
$content = file_get_contents($this->path);
|
$content = file_get_contents($this->path);
|
||||||
|
|
Loading…
Reference in New Issue