Skip to content

Commit

Permalink
Fix CookieJar::queue() method signature
Browse files Browse the repository at this point in the history
  • Loading branch information
jhaoda committed Nov 6, 2016
1 parent ee385fa commit 9f19107
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/Illuminate/Contracts/Cookie/QueueingFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ interface QueueingFactory extends Factory
/**
* Queue a cookie to send with the next response.
*
* @param array $params
*
* @return void
*/
public function queue();
public function queue(...$params);

/**
* Remove a cookie from the queue.
Expand Down
10 changes: 6 additions & 4 deletions src/Illuminate/Cookie/CookieJar.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,16 @@ public function queued($key, $default = null)
/**
* Queue a cookie to send with the next response.
*
* @param array $params
*
* @return void
*/
public function queue()
public function queue(...$params)
{
if (head(func_get_args()) instanceof Cookie) {
$cookie = head(func_get_args());
if (head($params) instanceof Cookie) {
$cookie = head($params);
} else {
$cookie = call_user_func_array([$this, 'make'], func_get_args());
$cookie = call_user_func_array([$this, 'make'], $params);
}

$this->queued[$cookie->getName()] = $cookie;
Expand Down

0 comments on commit 9f19107

Please sign in to comment.