Log collected source files.

@param JsonFile $jsonFile json file
970954
protected function logCollectedSourceFiles(JsonFile $jsonFile)
    {
        $sourceFiles = $jsonFile->getSourceFiles();
        $numFiles = count($sourceFiles);

        $this->logger->info(sprintf('Found <info>%s</info> source file%s:', number_format($numFiles), $numFiles > 1 ? 's' : ''));

        foreach ($sourceFiles as $sourceFile) {
            /* @var $sourceFile \PhpCoveralls\Bundle\CoverallsBundle\Entity\SourceFile */
            $coverage = $sourceFile->reportLineCoverage();
            $template = '  - ' . $this->colorizeCoverage($coverage, '%6.2f%%') . ' %s';

            $this->logger->info(sprintf($template, $coverage, $sourceFile->getName()));
        }

        $coverage = $jsonFile->reportLineCoverage();
        $template = 'Coverage: ' . $this->colorizeCoverage($coverage, '%6.2f%% (%d/%d)');
        $metrics = $jsonFile->getMetrics();

        $this->logger->info(sprintf($template, $coverage, $metrics->getCoveredStatements(), $metrics->getStatements()));
    }
94851
function logJsHintWarning (errors)
{
    totalIssues += errors.length;

    var sourceFile = pathHelper.makeRelative(this.resourcePath);
    gulpUtil.log(gulpUtil.colors.yellow("jshint warning") + " in " + sourceFile);

    for (var i = 0, l = errors.length; i < l; i++)
    {
        var error = errors[i];

        gulpUtil.log(
            "    in " +
            gulpUtil.colors.blue("line " + error.line + " @ char " + error.character) +
            ": " +
            error.reason +
            " (" + error.code + ")"
        );

        if (typeof error.evidence === "string")
        {
            gulpUtil.log(
                "        " +
                gulpUtil.colors.gray(error.evidence.replace(/^\s*|\s*$/, ""))
            );
        }

        gulpUtil.log("");
    }
}
16901
public function docs($jsonFile = null)
    {
        $filePath = config('l5-swagger.paths.docs').'/'.
            (! is_null($jsonFile) ? $jsonFile : config('l5-swagger.paths.docs_json', 'api-docs.json'));

        if (! File::exists($filePath)) {
            try {
                Generator::generateDocs();
            } catch (\Exception $e) {
                abort(404, 'Cannot find '.$filePath.' and cannot be generated.');
            }
        }

        $content = File::get($filePath);

        return Response::make($content, 200, [
            'Content-Type' => 'application/json',
        ]);
    }
785631
private function parseJson($jsonString)
    {
        $jsonData = json_decode($jsonString, true);

        if ($jsonData === null) {
            $this->emit('error', [json_last_error_msg()]);
            return;
        }

        $this->setContent($jsonString);
        $this->setData($jsonData);
        $this->emit('end');
    }
617599
public static function convertIniToJson( $sourceFile, $targetFile )
	{
		$data	= self::loadIni( $sourceFile );
		return self::saveJson( $targetFile, $data );
	}
813862
protected static function inputValidate($data, string $jsonShemaFile): bool
    {
        $fullPath = cfg::baseDir() . cfg::JSON_SCHEMA . cfg::DS;
        $jsonSchema = $fullPath . $jsonShemaFile;

        if (Json::validate($data, $jsonSchema)) {
            return true;
        }

        return false;
    }
1249117
protected function loadPackages(JsonFile $lockFile)
    {
        $lock = $lockFile->read();
        foreach ($this->managers as $name => $m) {
            $m->setConfig($lock[$name]);
        }
    }
829259
private function findSourceFilesFromList(array $filenames): void
  {
    foreach ($filenames as $filename)
    {
      if (!file_exists($filename))
      {
        $this->io->error(sprintf("File not exists: '%s'", $filename));
        $this->errorFilenames[] = $filename;
      }
      else
      {
        $routineName     = pathinfo($filename, PATHINFO_FILENAME);
        $this->sources[] = ['path_name'    => $filename,
                            'routine_name' => $routineName,
                            'method_name'  => $this->methodName($routineName)];
      }
    }
  }
161067
private static function log($data) {
        if (!$data) {
            $data = new \stdClass();
            $data->ua = self::$ua;
        } 
        $jsonData = json_encode($data);
        echo $jsonData."\r\n";
        //$fp = fopen(__DIR__."/log/user_agents.log", "a");
        //fwrite($fp, $jsonData."\r\n");
        //fclose($fp);
    }
233916
public function getFieldCount($jsonResponse, $fieldName)
    {
        $arr = json_decode($jsonResponse)->{$fieldName};
        return count($arr, COUNT_RECURSIVE);
    }
192424
protected static function readJsonFile(string $jsonFilePath)
    {
        if (!file_exists($jsonFilePath)) {
            throw new Exception(
                'File '.$jsonFilePath.' not found.',
                self::ERR_FILE_NOT_FOUND
            );
        }

        $infos = json_decode(file_get_contents($jsonFilePath));
        if ($infos === null) {
            throw new Exception(
                json_last_error_msg(),
                self::ERR_JSON_PARSE
            );
        }

        return $infos;
    }
88259
public function read(string $file, &$contents = null, bool $json = true, int $ttl = null): bool
    {
        $this->checkDirectory() && $ok = $this->checkFile($file);

        if ($ok) { // file exists
            if (filemtime($file) < time() - ($ttl ?? self::TTL)) {
                $contents = null;

                unlink($file); // do gc

                return false;
            }
        }

        $contents = file_get_contents($file);
        if ($json && $contents !== false) {
            $contents = json_decode($contents, true);
        }

        return ($contents !== false);
    }
833735
public List<Feature> parseJsonFiles(List<String> jsonFiles) {
        if (jsonFiles.isEmpty()) {
            throw new ValidationException("None report file was added!");
        }

        List<Feature> featureResults = new ArrayList<>();
        for (int i = 0; i < jsonFiles.size(); i++) {
            String jsonFile = jsonFiles.get(i);
            // if file is empty (is not valid JSON report), check if should be skipped or not
            if (new File(jsonFile).length() == 0
                    && configuration.containsReducingMethod(ReducingMethod.SKIP_EMPTY_JSON_FILES)) {
                continue;
            }
            Feature[] features = parseForFeature(jsonFile);
            LOG.log(Level.INFO, String.format("File '%s' contains %d features", jsonFile, features.length));
            featureResults.addAll(Arrays.asList(features));
        }

        // report that has no features seems to be not valid
        if (featureResults.isEmpty()) {
            throw new ValidationException("Passed files have no features!");
        }

        return featureResults;
    }
541466
public function log(): void
    {
        if (file_exists(FLOW_PATH_DATA . 'Logs/Elasticsearch') && is_dir(FLOW_PATH_DATA . 'Logs/Elasticsearch') && is_writable(FLOW_PATH_DATA . 'Logs/Elasticsearch')) {
            file_put_contents($this->filename, $this->renderErrors());
            $this->logger->log($this->message, LOG_ERR, [], 'Flowpack.ElasticSearch.ContentRepositoryAdaptor', __CLASS__, __FUNCTION__);
        } else {
            $this->logger->log(sprintf('Could not write indexing errors backtrace into %s because the directory could not be created or is not writable.', FLOW_PATH_DATA . 'Logs/Elasticsearch/'), LOG_WARNING, [], 'Flowpack.ElasticSearch.ContentRepositoryAdaptor', __CLASS__, __FUNCTION__);
        }
    }
1307717
public static <T> T withJsonFile(File jsonFile,
            TypeReference<T> typeReference) {
        try {
            return jsonMapper.readValue(jsonFile, typeReference);
        } catch (Exception e) {
            return JMExceptionManager.handleExceptionAndReturnNull(log, e,
                    "withJsonFile", jsonFile);
        }
    }
1344812
private function _save($pFile)
    {
        if (isset($this->_files[$pFile])) {
            return FileData::write($pFile, json_encode($this->_files[$pFile]));
        }
    }
191764
public function writelnJson($jsonString)
    {
        $keyColor = preg_replace('/"(\w+)": /', '<info>$1</info>: ', $jsonString);
        $valColor = preg_replace('/"([^"]+)"/', "<fg=cyan>'$1'</fg=cyan>", $keyColor);

        $this->output->writeln(stripslashes($valColor));
    }