function SecurityAdvisory::createFromArray
Same name in other branches
- 9 core/modules/system/src/SecurityAdvisories/SecurityAdvisory.php \Drupal\system\SecurityAdvisories\SecurityAdvisory::createFromArray()
- 10 core/modules/system/src/SecurityAdvisories/SecurityAdvisory.php \Drupal\system\SecurityAdvisories\SecurityAdvisory::createFromArray()
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']);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.