HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: /home/xedaptot/be.naniguide.com/app/Library/GeneralTagResolver.php
<?php

namespace App\Library;

use App\Library\Contracts\TagResolverInterface;
use Carbon\Carbon;

/**
 * Stateless resolver for app-wide, time-based tags
 * available in every email/subject/plain pipeline:
 *
 *   {{ CURRENT_YEAR }}, {{ current_date }}, {{ CURRENT_DATETIME }}, ...
 *
 * Keys are returned lowercase; TagTranslationService::duplicateUppercaseKeys()
 * auto-generates the UPPER variants, so both casings work in templates.
 */
class GeneralTagResolver implements TagResolverInterface
{
    public function getResolvedTags(): array
    {
        $now = Carbon::now();

        return [
            'current_year'       => $now->format('Y'),
            'current_month'      => $now->format('m'),
            'current_month_name' => $now->format('F'),
            'current_day'        => $now->format('d'),
            'current_weekday'    => $now->format('l'),
            'current_date'       => $now->format('Y-m-d'),
            'current_time'       => $now->format('H:i:s'),
            'current_datetime'   => $now->format('Y-m-d H:i:s'),
        ];
    }
}