Skip to content

Commit

Permalink
refactor: check is GA_TAG env var exists before access
Browse files Browse the repository at this point in the history
  • Loading branch information
poyuk committed Mar 13, 2024
1 parent 8b17b52 commit bae51ab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions helpers/Layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -593,8 +593,8 @@ public static function getThemeStylesheet($target)
*/
public static function printAnalyticsCode(): void
{
$gaTag = $_ENV['GA_TAG'];
$environment = $_ENV['NODE_ENV'] === 'production' ? 'Production' : 'Internal';
$gaTag = $_ENV['GA_TAG'] ?? '';
$environment = isset($_ENV['NODE_ENV']) && $_ENV['NODE_ENV'] === 'production' ? 'Production' : 'Internal';

if ($gaTag && method_exists(self::$templateClass, 'inc')) {
call_user_func(
Expand Down

0 comments on commit bae51ab

Please sign in to comment.