Skip to content

Commit

Permalink
Merge pull request #229 from HiEventsDev/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
daveearley authored Sep 15, 2024
2 parents 4d52f34 + 1b84773 commit d9e8c0d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
[![X (formerly Twitter) Follow](https://img.shields.io/twitter/follow/HiEventsTickets)](https://x.com/HiEventsTickets)
<br/>
[![Hi.Events docs](https://img.shields.io/badge/docs-hi.events-blue)](https://hi.events/docs)
[![License: AGPL v3](https://img.shields.io/badge/License-AGPL_v3-blue.svg)](https://github.com/HiEventsDev/hi.events/LICENCE)
[![License: AGPL v3](https://img.shields.io/badge/License-AGPL_v3-blue.svg)](https://github.com/HiEventsDev/Hi.Events/blob/develop/LICENCE)
[![GitHub Release](https://img.shields.io/github/v/release/HiEventsDev/hi.events?include_prereleases)](https://github.com/HiEventsDev/hi.events/releases)
[![Run Unit Tests](https://github.com/HiEventsDev/hi.events/actions/workflows/unit-tests.yml/badge.svg?event=push)](https://github.com/HiEventsDev/hi.events/actions/workflows/unit-tests.yml)
[![Docker Pulls](https://img.shields.io/docker/pulls/daveearley/hi.events-all-in-one)](https://hub.docker.com/r/daveearley/hi.events-all-in-one)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class CheckoutSessionManagementService
{
private const SESSION_IDENTIFIER = 'session_identifier';

private ?string $sessionId = null;

public function __construct(
private readonly Request $request,
)
Expand All @@ -22,13 +24,13 @@ public function __construct(
*/
public function getSessionId(): string
{
$sessionId = $this->request->cookie(self::SESSION_IDENTIFIER);

if (!$sessionId) {
$sessionId = $this->createSessionId();
if ($this->sessionId) {
return $this->sessionId;
}

return $sessionId;
$this->sessionId = $this->request->cookie(self::SESSION_IDENTIFIER) ?? $this->createSessionId();

return $this->sessionId;
}

public function verifySession(string $identifier): bool
Expand Down

0 comments on commit d9e8c0d

Please sign in to comment.