public function setCookie($name, $value, $expire, $path, $domain, $secure, $httpOnly, $sameSite = 'Lax') {
$path = $this->webRoot ? : '/';
- if (PHP_VERSION_ID < 70300) {
- setcookie($name, $value, $expire, $path, $domain, $secure, $httpOnly);
- } else {
- setcookie($name, $value, [
- 'expires' => $expire,
- 'path' => $path,
- 'domain' => $domain,
- 'secure' => $secure,
- 'httponly' => $httpOnly,
- 'samesite' => $sameSite
- ]);
- }
+ setcookie($name, $value, [
+ 'expires' => $expire,
+ 'path' => $path,
+ 'domain' => $domain,
+ 'secure' => $secure,
+ 'httponly' => $httpOnly,
+ 'samesite' => $sameSite
+ ]);
}
}
$webRoot = '/';
}
- if (PHP_VERSION_ID < 70300) {
- setcookie(self::COOKIE_NAME, $this->passphrase, 0, $webRoot, '', $secureCookie, true);
- } else {
- setcookie(
- self::COOKIE_NAME,
- $this->passphrase,
- [
- 'expires' => 0,
- 'path' => $webRoot,
- 'domain' => '',
- 'secure' => $secureCookie,
- 'httponly' => true,
- 'samesite' => 'Lax',
- ]
- );
- }
+ setcookie(
+ self::COOKIE_NAME,
+ $this->passphrase,
+ [
+ 'expires' => 0,
+ 'path' => $webRoot,
+ 'domain' => '',
+ 'secure' => $secureCookie,
+ 'httponly' => true,
+ 'samesite' => 'Lax',
+ ]
+ );
}
}
}
}
private function startSession(bool $silence = false) {
- if (PHP_VERSION_ID < 70300) {
- $this->invoke('session_start', [], $silence);
- } else {
- $this->invoke('session_start', [['cookie_samesite' => 'Lax']], $silence);
- }
+ $this->invoke('session_start', [['cookie_samesite' => 'Lax']], $silence);
}
}