Browse Source

improve cookie class comments.

Taylor Otwell 14 years ago
parent
commit
fb66bf532d
1 changed files with 9 additions and 11 deletions
  1. 9 11
      system/cookie.php

+ 9 - 11
system/cookie.php

@@ -47,6 +47,11 @@ class Cookie {
 	/**
 	 * Create a new Cookie instance.
 	 *
+	 * Note: Cookies can be sent using the Cookie::put method.
+	 *       However, the number of parameters that method requires
+	 *       is somewhat cumbersome. Instantiating a new Cookie class
+	 *       and setting the properties can be a little easier on the eyes.
+	 *
 	 * @param  string  $name
 	 * @return void
 	 */
@@ -76,7 +81,7 @@ class Cookie {
 	{
 		if (is_null($this->name))
 		{
-			throw new \Exception("Error sending cookie. The cookie does not have a name.");
+			throw new \Exception("Attempting to send cookie without a name.");
 		}
 
 		return static::put($this->name, $this->value, $this->lifetime, $this->path, $this->domain, $this->secure);
@@ -90,15 +95,7 @@ class Cookie {
 	 */
 	public static function has($name)
 	{
-		foreach (func_get_args() as $key)
-		{
-			if (is_null(static::get($key)))
-			{
-				return false;
-			}
-		}
-
-		return true;
+		return ! is_null(static::get($key));
 	}
 
 	/**
@@ -129,7 +126,8 @@ class Cookie {
 	}
 
 	/**
-	 * Set the value of a cookie.
+	 * Set the value of a cookie. If a negative number of minutes is
+	 * specified, the cookie will be deleted.
 	 *
 	 * @param  string   $name
 	 * @param  string   $value