public static function SecurityAdvisory::createFromArray in Drupal 9
Creates a SecurityAdvisories instance from an array.
Parameters
mixed[] $data: The security advisory data as returned from the JSON feed.
Return value
self A new SecurityAdvisories object.
4 calls to SecurityAdvisory::createFromArray()
- SecurityAdvisoriesFetcher::getSecurityAdvisories in core/
modules/ system/ src/ SecurityAdvisories/ SecurityAdvisoriesFetcher.php - Gets security advisories that are applicable for the current site.
- SecurityAdvisoryTest::testCreateFromArray in core/
modules/ system/ tests/ src/ Unit/ SecurityAdvisories/ SecurityAdvisoryTest.php - Tests creating with valid data.
- SecurityAdvisoryTest::testCreateFromArrayInvalidField in core/
modules/ system/ tests/ src/ Unit/ SecurityAdvisories/ SecurityAdvisoryTest.php - Tests exceptions for invalid field types.
- SecurityAdvisoryTest::testCreateFromArrayMissingField in core/
modules/ system/ tests/ src/ Unit/ SecurityAdvisories/ SecurityAdvisoryTest.php - Tests exceptions with missing fields.
File
- core/
modules/ system/ src/ SecurityAdvisories/ SecurityAdvisory.php, line 100
Class
- SecurityAdvisory
- Provides a security advisory value object.
Namespace
Drupal\system\SecurityAdvisoriesCode
public static function createFromArray(array $data) : self {
static::validateAdvisoryData($data);
return new static($data['title'], $data['project'], $data['type'], $data['is_psa'], $data['link'], $data['insecure']);
}