Преглед на файлове

Merge pull request #474 from phpMv/update_response_code

Update response code
walkor преди 6 години
родител
ревизия
7f3341ce93
променени са 1 файла, в които са добавени 7 реда и са изтрити 4 реда
  1. 7 4
      Protocols/Http.php

+ 7 - 4
Protocols/Http.php

@@ -320,15 +320,18 @@ class Http
     }
 
     /**
-     * Add response header (http_response_code).
+     * Sets the HTTP response status code.
      *
-     * @param int $code
-     * @return void
+     * @param int $code The response code
+     * @return boolean|int The valid status code or FALSE if code is not provided and it is not invoked in a web server environment
      */
-    public static function responseCode($code) {
+    public static function responseCode($code) 
+    {
         if (isset(HttpCache::$codes[$code])) {
             HttpCache::$status = "HTTP/1.1 $code " . HttpCache::$codes[$code];
+            return $code;
         }
+        return false;
     }
 
     /**