public static function getJson($file, $assoc = true)
    {
        // @codeCoverageIgnoreStart
        if (!extension_loaded('json')) {
            throw new \Exception('The JSON extension is not loaded.');
        }
        // @codeCoverageIgnoreEnd
        if (!file_exists($file)) {
            throw new \InvalidArgumentException(htmlspecialchars("The $file file is missing."));
        }
        if (strrchr($file, '.') != '.json') {
            throw new \InvalidArgumentException(htmlspecialchars("The $file is not in JSON format."));
        }
        if (($json = file_get_contents($file)) === null) {
            throw new \Exception(htmlspecialchars("The $file file is not readable."));
        }
        if (($return = json_decode($json, $assoc)) === null) {
            throw new \Exception(htmlspecialchars("The JSON $file file is invalid."));
        }

        return $return;
    }