Skip to content

Commit

Permalink
Move up boolean expression to condition
Browse files Browse the repository at this point in the history
Makes it more readable but has same semantics
  • Loading branch information
caendesilva committed Nov 13, 2023
1 parent c03be1a commit abca991
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/realtime-compiler/src/Http/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ protected function generateCSRFToken(): string

protected function validateCSRFToken(?string $suppliedToken): bool
{
if ($suppliedToken === null) {
if ($suppliedToken === null || empty($_SESSION['csrf_token'])) {
return false;
}

return ! empty($_SESSION['csrf_token']) && hash_equals($_SESSION['csrf_token'], $suppliedToken);
return hash_equals($_SESSION['csrf_token'], $suppliedToken);
}

protected function writeToConsole(string $message, string $context = 'dashboard'): void
Expand Down

0 comments on commit abca991

Please sign in to comment.