Bläddra i källkod

Allow reopening responses if they haven't been shutdown yet.

Nathaniel van Diepen 7 år sedan
förälder
incheckning
5df5f3ca1d
1 ändrade filer med 8 tillägg och 0 borttagningar
  1. 8 0
      Http/response.class.php

+ 8 - 0
Http/response.class.php

@@ -11,6 +11,7 @@
 		private $code = 200;
 		public $headers = [];
 		protected $open = true;
+		protected $shutdown = false;
 		public function __construct(){}
 		public function __toString(){
 			return $this->body;
@@ -112,6 +113,7 @@
 			return $this;
 		}
 		public function shutdown(){
+			$this->shutdown = true;
 			$this->fire('beforeshutdown');
 			if($this->open){
 				$this->end();
@@ -125,6 +127,12 @@
 			flush();
 			$this->fire('aftershutdown');
 		}
+		public function open(){
+			if(!$this->shutdown){
+				$this->open = true;
+			}
+			return $this;
+		}
 		public static function locale(string $locale, string $domain, string $folder, string $codeset = 'UTF-8'){
 			$path = realpath($folder);
 			if($path !== false){