diff --git a/src/Response.php b/src/Response.php new file mode 100644 index 0000000..755685b --- /dev/null +++ b/src/Response.php @@ -0,0 +1,70 @@ + + * @copyright 2016 Studio Nexus + * @license MIT + * @version Release: 0.3.0 + * @link https://www.studionexus.co/php/damnstupidsimple + */ +namespace Core; + +class Response { + + private static $_instance = null; + private $data = []; + + private function __construct(){ + $this->data = array_merge($_GET, $_POST); + } + + static function redirect($html_location, $time = 0){ + if(!headers_sent()) + { + header("Location:".$html_location, TRUE, 302); + exit; + } + exit(''); + } + + static function get($key = null){ + if (self::$_instance === null) { + self::$_instance = new self; + } + + return self::$_instance->returnResponse($key); + } + + function returnResponse($key = null){ + if($key !== null){ + if(!isset($this->data[$key])){ + return null; + } + return $this->data[$key]; + }else{ + return $this->data; + } + } +} \ No newline at end of file