Skip to content

Commit ff5aa36

Browse files
committed
chore: added httpStatus param
1 parent 00f967b commit ff5aa36

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/Http/Response.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,30 +34,36 @@ public static function instance()
3434
/**
3535
* Sets data for success response.
3636
*
37-
* @param mixed $data Data to return on response
37+
* @param mixed $data Data to return on response
38+
* @param mixed $httpStatus
3839
*
3940
* @return self
4041
*/
41-
public static function success($data)
42+
public static function success($data, $httpStatus = 200)
4243
{
4344
self::$_data = $data;
4445
self::$_status = self::SUCCESS;
4546

47+
self::$_httpStatus = $httpStatus;
48+
4649
return self::instance();
4750
}
4851

4952
/**
5053
* Sets data for error response.
5154
*
52-
* @param mixed $data Data to return on response
55+
* @param mixed $data Data to return on response
56+
* @param mixed $httpStatus
5357
*
5458
* @return self
5559
*/
56-
public static function error($data)
60+
public static function error($data, $httpStatus = 400)
5761
{
5862
self::$_data = $data;
5963
self::$_status = self::ERROR;
6064

65+
self::$_httpStatus = $httpStatus;
66+
6167
return self::instance();
6268
}
6369

0 commit comments

Comments
 (0)