protected function loadOpenApiFile()
	{
		if (!is_null($this->outputInterface)) {
			$this->outputInterface->writeln('<info>Loading OpenAPI file : ' . $this->openApiFilePath . '</info>');
		}

		$fileContent = file_get_contents($this->openApiFilePath);

		// Parse the file using the right parser (json or yaml)

		$jsonException = null;

		if (!is_null($this->outputInterface)) {
			$this->outputInterface->writeln('<info>Decode JSON from OpenAPI file</info>');
		}

		try {
			$this->openApiFileContent = json_decode($fileContent, true);
		} catch (Exception $e) {
			$jsonException = $e;
		}

		$jsonLastError = json_last_error();

		if ($jsonLastError != JSON_ERROR_NONE)
		{
			if (!is_null($this->outputInterface)) {
				$this->outputInterface->writeln('<info>Can not decode JSON, try YAML</info>');
			}
			$this->openApiFileContent = Yaml::parse($fileContent, Yaml::PARSE_OBJECT | Yaml::PARSE_OBJECT_FOR_MAP | Yaml::PARSE_DATETIME | Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE);
		}

		if (!is_null($this->outputInterface)) {
			$this->outputInterface->writeln('<info>File decoded</info>');
		}
	}
protected function loadOpenApiFile()
	{
		if (!is_null($this->outputInterface)) {
			$this->outputInterface->writeln('<info>Loading OpenAPI file : ' . $this->openApiFilePath . '</info>');
		}

		$fileContent = file_get_contents($this->openApiFilePath);

		// Parse the file using the right parser (json or yaml)

		$jsonException = null;

		if (!is_null($this->outputInterface)) {
			$this->outputInterface->writeln('<info>Decode JSON from OpenAPI file</info>');
		}

		try {
			$this->openApiFileContent = json_decode($fileContent, true);
		} catch (Exception $e) {
			$jsonException = $e;
		}

		$jsonLastError = json_last_error();

		if ($jsonLastError != JSON_ERROR_NONE)
		{
			if (!is_null($this->outputInterface)) {
				$this->outputInterface->writeln('<info>Can not decode JSON, try YAML</info>');
			}
			$this->openApiFileContent = Yaml::parse($fileContent, Yaml::PARSE_OBJECT | Yaml::PARSE_OBJECT_FOR_MAP | Yaml::PARSE_DATETIME | Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE);
		}

		if (!is_null($this->outputInterface)) {
			$this->outputInterface->writeln('<info>File decoded</info>');
		}
	}
protected function loadOpenApiFile ( ) { if ( ! is_null ( $ this -> outputInterface ) ) { $ this -> outputInterface -> writeln ( '<info>Loading OpenAPI file : ' . $ this -> openApiFilePath . '</info>' ) ; } $ fileContent = file_get_contents ( $ this -> openApiFilePath ) ; // Parse the file using the right parser (json or yaml)
 $ jsonException = null ; if ( ! is_null ( $ this -> outputInterface ) ) { $ this -> outputInterface -> writeln ( '<info>Decode JSON from OpenAPI file</info>' ) ; } try { $ this -> openApiFileContent = json_decode ( $ fileContent , true ) ; } catch ( Exception $ e ) { $ jsonException = $ e ; } $ jsonLastError = json_last_error ( ) ; if ( $ jsonLastError != JSON_ERROR_NONE ) { if ( ! is_null ( $ this -> outputInterface ) ) { $ this -> outputInterface -> writeln ( '<info>Can not decode JSON, try YAML</info>' ) ; } $ this -> openApiFileContent = Yaml :: parse ( $ fileContent , Yaml :: PARSE_OBJECT | Yaml :: PARSE_OBJECT_FOR_MAP | Yaml :: PARSE_DATETIME | Yaml :: PARSE_EXCEPTION_ON_INVALID_TYPE ) ; } if ( ! is_null ( $ this -> outputInterface ) ) { $ this -> outputInterface -> writeln ( '<info>File decoded</info>' ) ; } }
Load the OpenAPI file content
Load the OpenAPI file content