PayWithAmazon\Client::checkIfFileExists PHP Method

checkIfFileExists() private method

* checkIfFileExists - check if the JSON file exists in the path provided
private checkIfFileExists ( $config )
    private function checkIfFileExists($config)
    {
        if (file_exists($config)) {
            $jsonString = file_get_contents($config);
            $configArray = json_decode($jsonString, true);
            $jsonError = json_last_error();
            if ($jsonError != 0) {
                $errorMsg = "Error with message - content is not in json format" . $this->getErrorMessageForJsonError($jsonError) . " " . $configArray;
                throw new \Exception($errorMsg);
            }
        } else {
            $errorMsg = '$config is not a Json File path or the Json File was not found in the path provided';
            throw new \Exception($errorMsg);
        }
        return $configArray;
    }