Skip to content
PHP Ecosystem
Explore

PnpmAuditParser

API reference › Foxy › Audit › Parser › PnpmAuditParser

final classFoxy\Audit\Parser\PnpmAuditParser
ExtendsAbstractAuditParser
ImplementsFoxy\Audit\AuditParserInterface
Sourcesrc/Audit/Parser/PnpmAuditParser.php

Parses the JSON advisory report produced by pnpm audit.

MethodDescriptionDefined by
parse()Parses a complete pnpm audit report.PnpmAuditParser
assertNotErrorDocument() protected finalRejects a JSON document that represents a package manager error.AbstractAuditParser
assertOutputSize() protected finalRejects audit output that exceeds the parser’s size limit.AbstractAuditParser
decodeObject() protected finalDecodes an audit JSON object after validating its size and shape.AbstractAuditParser
getAdvisoryId() protected finalSelects a GHSA identifier from the candidate or URL, falling back to the source identifier.AbstractAuditParser
getBoolean() protected finalReturns a required boolean field.AbstractAuditParser
getCves() protected finalReturns validated, normalized CVE identifiers.AbstractAuditParser
getGhsaId() protected finalExtracts and normalizes a GHSA identifier from a value or URL.AbstractAuditParser
getManagerName() protectedReturns the pnpm manager name.PnpmAuditParser
getNonNegativeInteger() protected finalReturns a required non-negative integer field.AbstractAuditParser
getObject() protected finalConverts a decoded JSON object into its property map.AbstractAuditParser
getOptionalString() protected finalReturns a sanitized optional string field, or null when absent or empty.AbstractAuditParser
getSeverity() protected finalReturns a supported normalized severity value.AbstractAuditParser
getSeverityCount() protected finalReturns the sum of severity counts and optionally validates the reported total.AbstractAuditParser
getSourceId() protected finalReturns a non-empty source identifier from a string or integer value.AbstractAuditParser
getString() protected finalReturns a required sanitized string field.AbstractAuditParser
getStringList() protected finalReturns a normalized list containing only strings.AbstractAuditParser
malformed() protected finalCreates a package-manager-specific malformed-output exception.AbstractAuditParser
sanitizeString() protected finalReplaces control characters and trims surrounding whitespace.AbstractAuditParser
uniqueStrings() protected finalReturns unique strings in deterministic order.AbstractAuditParser
public function parse(string $output): array

Parses a complete pnpm audit report.

Parameters

ParameterTypeDescription
$outputstring

Returns

array

protected function getManagerName(): string

Returns the pnpm manager name.

Returns

string