浏览代码

compliance with php http_response_code function

jcheron 6 年之前
父节点
当前提交
3367e7632f
共有 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 mixed 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;
     }
 
     /**