0 follower

Final Class Yiisoft\HttpMiddleware\ForceSecureConnection\HstsHeader

InheritanceYiisoft\HttpMiddleware\ForceSecureConnection\HstsHeader

Represents the Strict-Transport-Security header.

Constants

Hide inherited constants

Constant Value Description Defined By
DEFAULT_MAX_AGE 31536000 Yiisoft\HttpMiddleware\ForceSecureConnection\HstsHeader

Property Details

Hide inherited properties

$maxAge public property
public integer $maxAge self::DEFAULT_MAX_AGE
$subdomains public property
public boolean $subdomains false

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( integer $maxAge self::DEFAULT_MAX_AGE, boolean $subdomains false )
$maxAge integer

The max age.

$subdomains boolean

Whether to add the includeSubDomains option to the header value.

                public function __construct(
    public readonly int $maxAge = self::DEFAULT_MAX_AGE,
    public readonly bool $subdomains = false,
) {
}

            
getValue() public method

public string getValue ( )

                public function getValue(): string
{
    $value = 'max-age=' . $this->maxAge;
    if ($this->subdomains) {
        $value .= '; includeSubDomains';
    }
    return $value;
}