You are here

public function SecuritytxtSerializer::getSecuritytxtSignature in Security.txt 8

Gets the body of a security.txt.sig file.

Parameters

\Drupal\Core\Config\ImmutableConfig $settings: A 'securitytxt.settings' config instance.

Return value

string The body of a security.txt.sig file.

Throws

\Symfony\Component\HttpKernel\Exception\NotFoundHttpException When the security.txt file is disabled.

File

src/SecuritytxtSerializer.php, line 86

Class

SecuritytxtSerializer
Securitytxt serializer class.

Namespace

Drupal\securitytxt

Code

public function getSecuritytxtSignature(ImmutableConfig $settings) {
  $enabled = $settings
    ->get('enabled');
  $signature_text = $settings
    ->get('signature_text');
  if ($enabled) {
    return $signature_text;
  }
  else {
    throw new NotFoundHttpException();
  }
}