<?php
/**
 * class response
 *
 * Description for class response
 *
 * @author:
*/
namespace core;

class response {
	public static function json($object) {
		header("Content-Type: application/json");
		print json_encode($object);
		exit;
	}

	public static function isSSL() {
		if(isset($_SERVER["HTTPS"])) {
			if("on" == strtolower($_SERVER["HTTPS"])) {
				return true;
			}

			if("1" == $_SERVER["HTTPS"]) {
				return true;
			}
		} elseif(isset($_SERVER["SERVER_PORT"]) && ("443" == $_SERVER["SERVER_PORT"])) {
			return true;
		}

		return false;
	}

	public static function isProduction() {
		$whitelist = array("127.0.0.1", "::1");

		if(!in_array($_SERVER["REMOTE_ADDR"], $whitelist)) {
			return false;
		}

		return true;
	}
}
?>