Skip to content

Commit

Permalink
AD-231 Consolidate variable name to expires as it can not contain opt…
Browse files Browse the repository at this point in the history
…ions
  • Loading branch information
Dani Esteban authored and kpicaza committed May 27, 2022
1 parent 71256dd commit bfdc5eb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/Sifo/Cookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ static private function _sanitizeCookie( $cookie )
return false;
}

static protected function setCookie(string $name, $value = "", $expires_or_options = 0, $path = "", $domain = "", $secure = false, $httponly = false, string $samesite = null): bool
static protected function setCookie(string $name, $value = "", $expires = 0, $path = "", $domain = "", $secure = false, $httponly = false, string $samesite = null): bool
{
$options = [
'expires' => $expires_or_options,
'expires' => $expires,
'path' => $path,
'domain' => $domain,
'secure' => $secure,
Expand Down
6 changes: 3 additions & 3 deletions test/Sifo/CookieTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function testCookieIsSetWithExpectedDefaults(): void

$this->assertEquals(
$defaultExpiration,
TestCookie::getExpiresOrOptions($cookieName),
TestCookie::getExpires($cookieName),
"Expires doesn't match with expected."
);
$this->assertSame(
Expand All @@ -45,7 +45,7 @@ public function testCookieCanBeSetWithoutExpiration(): void

TestCookie::set($cookieName, 'oreo', 0);

$this->assertSame(0, TestCookie::getExpiresOrOptions($cookieName));
$this->assertSame(0, TestCookie::getExpires($cookieName));
}

public function testCookieIsSetWithCustomParameters(): void
Expand All @@ -58,7 +58,7 @@ public function testCookieIsSetWithCustomParameters(): void

$this->assertEquals(
$defaultExpiration,
TestCookie::getExpiresOrOptions($cookieName),
TestCookie::getExpires($cookieName),
"Expires doesn't match with expected."
);
$this->assertSame(
Expand Down
8 changes: 4 additions & 4 deletions test/Sifo/TestCookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class TestCookie extends Cookie
protected static function setCookie(
string $name,
$value = "",
$expires_or_options = 0,
$expires = 0,
$path = "",
$domain = "",
$secure = false,
Expand All @@ -26,7 +26,7 @@ protected static function setCookie(

self::$cookies[$name] = [
'value' => $value,
'expires_or_options' => $expires_or_options,
'expires' => $expires,
'path' => $path,
'domain' => $domain,
'secure' => $secure,
Expand Down Expand Up @@ -55,9 +55,9 @@ public static function getValue(string $name): string
return (string) self::getCookieParam($name, 'value');
}

public static function getExpiresOrOptions(string $name)
public static function getExpires(string $name)
{
return self::getCookieParam($name, 'expires_or_options');
return self::getCookieParam($name, 'expires');
}

public static function getPath(string $name): string
Expand Down

0 comments on commit bfdc5eb

Please sign in to comment.