You are here

private static function Csp::validateDirectiveName in Content-Security-Policy 8

Check if a directive name is valid, throwing an exception if not.

Parameters

string $name: The directive name.

Throws

\InvalidArgumentException

7 calls to Csp::validateDirectiveName()
Csp::appendDirective in src/Csp.php
Append values to an existing directive.
Csp::fallbackAwareAppendIfEnabled in src/Csp.php
Append to a directive if it or a fallback directive is enabled.
Csp::getDirective in src/Csp.php
Get the value of a directive.
Csp::getDirectiveFallbackList in src/Csp.php
Get the fallback list for a directive.
Csp::getDirectiveSchema in src/Csp.php
Get the schema constant for a directive.

... See full list

File

src/Csp.php, line 166

Class

Csp
A CSP Header.

Namespace

Drupal\csp

Code

private static function validateDirectiveName($name) {
  if (!static::isValidDirectiveName($name)) {
    throw new \InvalidArgumentException("Invalid directive name provided");
  }
}