more refactoring on DI and IoC.

This commit is contained in:
Taylor Otwell
2011-09-20 23:36:13 -05:00
parent 4525eae25a
commit 600e411ad4
10 changed files with 36 additions and 144 deletions

View File

@@ -2,13 +2,6 @@
class Cookie {
/**
* The cookies that will be sent to the browser at the end of the request.
*
* @var array
*/
protected static $queue = array();
/**
* Determine if a cookie exists.
*
@@ -84,26 +77,13 @@ class Cookie {
*/
public static function put($name, $value, $minutes = 0, $path = '/', $domain = null, $secure = false, $http_only = false)
{
if (headers_sent()) return false;
if ($minutes < 0) unset($_COOKIE[$name]);
$time = ($minutes != 0) ? time() + ($minutes * 60) : 0;
static::$queue[] = compact('name', 'value', 'time', 'path', 'domain', 'secure', 'http_only');
}
/**
* Send all of the cookies in the queue to the browser.
*
* This method is called automatically at the end of every request.
*
* @return void
*/
public static function send()
{
foreach (static::$queue as $cookie)
{
call_user_func_array('setcookie', $cookie);
}
return setcookie($name, $value, $time, $path, $domain, $secure, $http_only);
}
/**