ok

Mini Shell

Direktori : /home2/selectio/www/limpiar.in.net/vendor/lcobucci/jwt/src/Encoding/
Upload File :
Current File : //home2/selectio/www/limpiar.in.net/vendor/lcobucci/jwt/src/Encoding/UnixTimestampDates.php

<?php
declare(strict_types=1);

namespace Lcobucci\JWT\Encoding;

use DateTimeImmutable;
use Lcobucci\JWT\ClaimsFormatter;
use Lcobucci\JWT\Token\RegisteredClaims;

use function array_key_exists;

final class UnixTimestampDates implements ClaimsFormatter
{
    /** @inheritdoc */
    public function formatClaims(array $claims): array
    {
        foreach (RegisteredClaims::DATE_CLAIMS as $claim) {
            if (! array_key_exists($claim, $claims)) {
                continue;
            }

            $claims[$claim] = $this->convertDate($claims[$claim]);
        }

        return $claims;
    }

    private function convertDate(DateTimeImmutable $date): int
    {
        return $date->getTimestamp();
    }
}

Zerion Mini Shell 1.0