AuditNormalizer
API reference › Foxy › Audit › AuditNormalizer
Normalizes GHSA and CVE advisory identifiers and the string lists attached to audit findings.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
isCveId() static | Returns whether the value is a CVE identifier, matched case-insensitively. | AuditNormalizer |
normalizeGhsaId() static | Returns the canonical GHSA identifier (uppercase prefix, lowercase segments), or null if the value is not a bare GHSA identifier. | AuditNormalizer |
normalizeGhsaReference() static | 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. | AuditNormalizer |
uniqueSorted() static | Returns the values without duplicates, sorted in ascending order and reindexed as a list. | AuditNormalizer |
Method details
Section titled “Method details”isCveId()
Section titled “isCveId() ”public static function isCveId(string $value): boolReturns whether the value is a CVE identifier, matched case-insensitively.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | string | Candidate identifier, already trimmed by the caller. |
Returns
bool
normalizeGhsaId()
Section titled “normalizeGhsaId() ”public static function normalizeGhsaId(string $value): string|nullReturns the canonical GHSA identifier (uppercase prefix, lowercase segments), or null if the value is not a bare
GHSA identifier.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | string | Candidate identifier, already trimmed by the caller. |
Returns
string|null
normalizeGhsaReference()
Section titled “normalizeGhsaReference() ”public static function normalizeGhsaReference(string $value): string|nullReturns 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
| Parameter | Type | Description |
|---|---|---|
$value | string | Candidate identifier or advisory URL. |
Returns
string|null
uniqueSorted()
Section titled “uniqueSorted() ”public static function uniqueSorted(list<string> $values): list<string>Returns the values without duplicates, sorted in ascending order and reindexed as a list.
Parameters
| Parameter | Type | Description |
|---|---|---|
$values | list<string> | Values to deduplicate and sort. |
Returns
list<string>