Esempio n. 1
0
 /**
  * @param SplFileInfo $file
  *
  * @return mixed
  * @throws \Seld\JsonLint\ParsingException
  */
 public function lint(SplFileInfo $file)
 {
     $errors = new LintErrorsCollection();
     $flags = $this->calculateFlags();
     try {
         $json = $this->filesystem->readFromFileInfo($file);
         $this->jsonParser->parse($json, $flags);
     } catch (ParsingException $exception) {
         $errors->add(JsonLintError::fromParsingException($file, $exception));
     }
     return $errors;
 }
Esempio n. 2
0
 /**
  * @param SplFileInfo $file
  *
  * @return mixed
  * @throws \Seld\JsonLint\ParsingException
  */
 public function lint(SplFileInfo $file)
 {
     $parser = new JsonParser();
     $errors = new LintErrorsCollection();
     $flags = $this->calculateFlags();
     try {
         $json = file_get_contents($file->getPathname());
         $parser->parse($json, $flags);
     } catch (ParsingException $exception) {
         $errors->add(JsonLintError::fromParsingException($file, $exception));
     }
     return $errors;
 }