Dump api-docs.json content endpoint.

@param string $jsonFile

@return \Response
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',
        ]);
    }
228839
private function executeTool($jsonFile, $lockFile, $errorMessage)
    {
        if (true === $jsonFile && false === $lockFile) {
            $this->output->writeln($this->outputMessage->getFailMessage());
            $this->output->writeln(BadJobLogoResponse::paint($errorMessage));
            throw new ComposerFilesNotFoundException();
        }
    }
1296884
static Swagger validate( File jsonFile ) throws Exception {

		// Validate with the Swagger parser
		SwaggerDeserializationResult res = new SwaggerParser().readWithInfo( jsonFile.getAbsolutePath(), null, true );
		if( ! res.getMessages().isEmpty()) {
			for( String s : res.getMessages())
				System.out.println( s );

			throw new Exception( "Errors were found in a Swagger definition: " + jsonFile.getAbsolutePath());
		}

		return res.getSwagger();
	}
1059884
public function saveSnippet(
        string $outputFile,
        string $format = self::FORMAT_NGINX
    ): bool {
        if ($this->needsCompile) {
            $this->compile();
        }

        // Are we doing a report-only header?
        $which = $this->reportOnly
            ? 'Content-Security-Policy-Report-Only'
            : 'Content-Security-Policy';

        switch ($format) {
            case self::FORMAT_NGINX:
                // In PHP < 7, implode() is faster than concatenation
                $output = \implode('', [
                    'add_header ',
                    $which,
                    ' "',
                    \rtrim($this->compiled, ' '),
                    '" always;',
                    "\n"
                ]);
                break;
            case self::FORMAT_APACHE:
                $output = \implode('', [
                    'Header add ',
                    $which,
                    ' "',
                    \rtrim($this->compiled, ' '),
                    '"',
                    "\n"
                ]);
                break;
            default:
                throw new \Exception('Unknown format: '.$format);
        }
        return \file_put_contents($outputFile, $output) !== false;
    }
1340936
public static function fromJson($jsonFile)
    {
        if (!is_file($jsonFile) && !is_readable($jsonFile)) {
            throw new \RuntimeException("Either '$jsonFile' is not a file or cannot access it");
        }
        $content = file_get_contents($jsonFile);
        if (!$content) {
            throw new \RuntimeException("Cannot load empty JSON file '$jsonFile'");
        }
        $json = json_decode($content, true);
        if (!$json) {
            throw new \RuntimeException("Could not parse JSON from '$jsonFile'");
        }
        return new \DataFilter\Profile($json);
    }
798090
function insertHTTPFile( $object, $objectVersion, $objectLanguage,
                             $objectAttribute, $httpFile, $mimeData,
                             &$result )
    {
        $result = array( 'errors' => array(),
                         'require_storage' => false );
        $attributeID = $objectAttribute->attribute( 'id' );

        $media = eZMedia::fetch( $attributeID, $objectVersion );
        if ( $media === null )
            $media = eZMedia::create( $attributeID, $objectVersion );

        $httpFile->setMimeType( $mimeData['name'] );
        if ( !$httpFile->store( "original", false, false ) )
        {
            $result['errors'][] = array( 'description' => ezpI18n::tr( 'kernel/classes/datatypes/ezmedia',
                                                        'Failed to store media file %filename. Please contact the site administrator.', null,
                                                        array( '%filename' => $httpFile->attribute( "original_filename" ) ) ) );
            return false;
        }

        $classAttribute = $objectAttribute->contentClassAttribute();
        $player = $classAttribute->attribute( "data_text1" );
        $pluginPage = eZMediaType::pluginPage( $player );

        $media->setAttribute( "contentobject_attribute_id", $attributeID );
        $media->setAttribute( "version", $objectVersion );
        $media->setAttribute( "filename", basename( $httpFile->attribute( "filename" ) ) );
        $media->setAttribute( "original_filename", $httpFile->attribute( "original_filename" ) );
        $media->setAttribute( "mime_type", $mimeData['name'] );

        // Setting width and height to zero means that the browser/player must find the size itself.
        // In the future we will probably analyze the media file and find this information
        $width = $height = 0;
        // Quality is not known, so we don't set any
        $quality = false;
        // Not sure what this is for, set to false
        $controls = false;
        // We want to show controllers by default
        $hasController = true;
        // Don't play automatically
        $isAutoplay = false;
        // Don't loop movie
        $isLoop = false;

        $media->setAttribute( "width", $width );
        $media->setAttribute( "height", $height );
        $media->setAttribute( "quality", $quality );
        $media->setAttribute( "controls", $controls );
        $media->setAttribute( "pluginspage", $pluginPage );
        $media->setAttribute( "is_autoplay", $isAutoplay );
        $media->setAttribute( "has_controller", $hasController );
        $media->setAttribute( "is_loop", $isLoop );

        $filePath = $httpFile->attribute( 'filename' );
        $fileHandler = eZClusterFileHandler::instance();
        $fileHandler->fileStore( $filePath, 'mediafile', true, $mimeData['name'] );


        $media->store();

        $objectAttribute->setContent( $media );
        return true;
    }
1114273
protected function getJsonFile()
    {
        if (! $this->jsonFile) {
            $this->jsonFile = new JsonFile('composer.json', null, $this->io);
        }
        
        return $this->jsonFile;
    }
235667
def dump(self, file: TextIO, **kwargs) -> None:
        """"""
        return json.dump(self.to_json(), file, **kwargs)
10682
public function dump()
    {
        $content = $this->response->getContent();

        $json = json_decode($content);

        if (json_last_error() === JSON_ERROR_NONE) {
            $content = $json;
        }

        dd($content);
    }
527477
public function dump()
    {
        if (!method_exists($this->filesystem, 'dumpFile')) {
            throw new \RuntimeException('Method dumpFile() is not available on your Filesystem component version, you should upgrade it.');
        }

        $this->initDirection();
        $feed = $this->feedManager->get($this->name);

        if ($this->entity) {
            $repository = $this->em->getRepository($this->entity);
            $items = $repository->findBy([], $this->orderBy, $this->limit);
            $feed->addFromArray($items);
        } elseif ($feed->hasItems()) {
            throw new \LogicException(sprintf('An entity should be set OR you should use setItems() first'));
        }

        $dump = $feed->render($this->format);
        $filepath = $this->rootDir.$this->filename;

        $this->filesystem->dumpFile($filepath, $dump);
    }
1077607
public function outputJson($data = null, $httpCode = 200)
    {
        $this->setContentType('application/json; charset=UTF-8');
        $data = json_encode($data);

        if (!empty($this->response)) {
            $this->end($data, $httpCode);
        }
    }
617599
public static function convertIniToJson( $sourceFile, $targetFile )
	{
		$data	= self::loadIni( $sourceFile );
		return self::saveJson( $targetFile, $data );
	}
547882
@SuppressWarnings({"unchecked"})
    public <T> T read(File jsonFile) throws IOException {
        return read(jsonFile, Configuration.defaultConfiguration());
    }
855129
function JSONReporter(dir, config) {
    this._config = config;

    var fileName = config.file || DEFAULT_FILE_NAME;
    this._filePath = path.join(dir, fileName);
}
225715
public static <T> T withJsonFile(File jsonFile, Class<T> c) {
        try {
            return jsonMapper.readValue(jsonFile, c);
        } catch (Exception e) {
            return JMExceptionManager.handleExceptionAndReturnNull(log, e,
                    "withJsonFile", jsonFile);
        }
    }
561603
public function getContent($infile) {
    $contents = $this->smarty->fetch($infile);

    if ($this->filetype === 'php') {
      $this->beautifier->setInputString($contents);
      $this->beautifier->process();
      $contents = $this->beautifier->get();
      // The beautifier isn't as beautiful as one would hope. Here's some extra string fudging.
      $replacements = [
        ') ,' => '),',
        "\n  }\n}\n" => "\n  }\n\n}\n",
        '=> true,' => '=> TRUE,',
        '=> false,' => '=> FALSE,',
      ];
      $contents = str_replace(array_keys($replacements), array_values($replacements), $contents);
      $contents = preg_replace('#(\s*)\\/\\*\\*#', "\n\$1/**", $contents);
      // Convert old array syntax to new square brackets
      $contents = CRM_Core_CodeGen_Util_ArraySyntaxConverter::convert($contents);
    }

    return $contents;
  }
117147
private function _curlHelper(&$url, &$json = null)
    {
        $headers = [
            'Accept: application/json',
            'Accept-Encoding: gzip, deflate',
            'Connection: keep-alive',
            'Authorization: Bearer ' . $this->_token
        ];

        /*
         * If this is a request that has a body then we need to
         * include the content type, which in our case always is JSON.
         */
        if (isset($json)) {
            array_push($headers, 'Content-Type: application/json');
            curl_setopt($this->_curlHandle, CURLOPT_POSTFIELDS, $json);
        }

        curl_setopt($this->_curlHandle, CURLOPT_URL, $url);
        curl_setopt($this->_curlHandle, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($this->_curlHandle, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($this->_curlHandle, CURLOPT_USERAGENT, $this->_userAgent);

        $result = curl_exec($this->_curlHandle);

        if ($result === false) {
            throw new HttpCallException(curl_error($this->_curlHandle));
        }

        $httpStatus = curl_getinfo($this->_curlHandle, CURLINFO_HTTP_CODE);

        // If we have a logger then we can emit a bit of debug info.
        if (isset($this->_logger)) {
            $httpTime = curl_getinfo($this->_curlHandle, CURLINFO_TOTAL_TIME);
            $this->_logger->debug(
                'Request: {req}; Response (status {status}, took {time}s): {rsp}',
                [
                    'req' => $json,
                    'rsp' => $result,
                    'status' => $httpStatus,
                    'time' => $httpTime
                ]
            );
        }

        switch ($httpStatus) {
        case 200:               // OK
        case 201:               // Created
            break;
        case 400:               // Bad Request
        case 403:               // Forbidden
            $e = Deserialize::error($result);
            throw new ErrorResponseException($e->getCode(), $e->getText());
        case 404:               // Not Found
            throw new NotFoundException($url);
        case 401:               // Unauthorized
            throw new UnauthorizedException(
                $this->_servicePlanId, $this->_token
            );
        default:                // Everything else
            throw new UnexpectedResponseException(
                "Unexpected HTTP status $httpStatus", $result
            );
        }

        return $result;
    }