Skip to content
PHP Ecosystem
Explore

AuditNormalizer

API reference › Foxy › Audit › AuditNormalizer

final classFoxy\Audit\AuditNormalizer
Sourcesrc/Audit/AuditNormalizer.php

Normalizes GHSA and CVE advisory identifiers and the string lists attached to audit findings.

MethodDescriptionDefined by
isCveId() staticReturns whether the value is a CVE identifier, matched case-insensitively.AuditNormalizer
normalizeGhsaId() staticReturns the canonical GHSA identifier (uppercase prefix, lowercase segments), or null if the value is not a bare GHSA identifier.AuditNormalizer
normalizeGhsaReference() staticReturns the canonical GHSA identifier of a bare GHSA identifier or a https://github.com/advisories/ URL with an optional trailing slash, or null if the value is neither.AuditNormalizer
uniqueSorted() staticReturns the values without duplicates, sorted in ascending order and reindexed as a list.AuditNormalizer
public static function isCveId(string $value): bool

Returns whether the value is a CVE identifier, matched case-insensitively.

Parameters

ParameterTypeDescription
$valuestringCandidate identifier, already trimmed by the caller.

Returns

bool

public static function normalizeGhsaId(string $value): string|null

Returns the canonical GHSA identifier (uppercase prefix, lowercase segments), or null if the value is not a bare GHSA identifier.

Parameters

ParameterTypeDescription
$valuestringCandidate identifier, already trimmed by the caller.

Returns

string|null

public static function normalizeGhsaReference(string $value): string|null

Returns the canonical GHSA identifier of a bare GHSA identifier or a https://github.com/advisories/ URL with an optional trailing slash, or null if the value is neither.

Parameters

ParameterTypeDescription
$valuestringCandidate identifier or advisory URL.

Returns

string|null

public static function uniqueSorted(list<string> $values): list<string>

Returns the values without duplicates, sorted in ascending order and reindexed as a list.

Parameters

ParameterTypeDescription
$valueslist<string>Values to deduplicate and sort.

Returns

list<string>