/** * * @param blaze\lang\String|string $name The name of the cookie * @param blaze\lang\String|string $value The value of the cookie */ public function __construct($name, $value) { $name = new String($name); if ($name->startsWith('$') || $name->contains(',') || $name->contains(';') || $name->contains(' ')) { throw new IllegalArgumentException('The name of a cookie can only contain alphanumeric characters but not commas, semicolons, whitespaces or begin with $ character.'); } $this->name = $name; $this->value = String::asWrapper($value); }