0 follower

Final Class Yiisoft\Csrf\StubCsrfToken

InheritanceYiisoft\Csrf\StubCsrfToken
ImplementsYiisoft\Csrf\CsrfTokenInterface

StubCsrfToken represents a simple implementation of CsrfTokenInterface.

This implementation simply stores and returns a token string. It does not perform any additional validation. It is primarily used for testing or as a placeholder implementation.

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( ?string $token null )
$token ?string

                public function __construct(?string $token = null)
{
    if (null === $token) {
        $token = Random::string();
    }
    $this->token = $token;
}

            
getValue() public method

public string getValue ( )

                public function getValue(): string
{
    return $this->token;
}

            
validate() public method

public boolean validate ( string $token )
$token string

                public function validate(string $token): bool
{
    return $this->token === $token;
}