Skip to content

Commit

Permalink
feat: update cookies with new eien syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
mychidarko committed Oct 16, 2022
1 parent 4308c18 commit ff28690
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Cookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static function set($key, $value = '', array $options = [])
if (class_exists('Leaf\Eien\Server') && PHP_SAPI === 'cli') {
\Leaf\Config::set('response.cookies', array_merge(
\Leaf\Config::get('response.cookies'),
[$key, $value, $options['expires'] ?? (time() + 604800)],
[$key => [$value, $options['expires'] ?? (time() + 604800)]],
));

return;
Expand Down Expand Up @@ -91,7 +91,7 @@ public static function simpleCookie(string $name, string $value, string $expires
if (class_exists('Leaf\Eien\Server') && PHP_SAPI === 'cli') {
\Leaf\Config::set('response.cookies', array_merge(
\Leaf\Config::get('response.cookies'),
[$name, $value, $expires ?? (time() + 604800)],
[$name => [$value, $expires ?? (time() + 604800)]],
));

return;
Expand Down Expand Up @@ -126,7 +126,7 @@ public static function unset($key)
if (class_exists('Leaf\Eien\Server') && PHP_SAPI === 'cli') {
\Leaf\Config::set('response.cookies', array_merge(
\Leaf\Config::get('response.cookies'),
[$key, '', time() - 604800],
[$key => ['', time() - 604800]],
));
}

Expand Down

0 comments on commit ff28690

Please sign in to comment.