Skip to content

Commit

Permalink
Add typed params
Browse files Browse the repository at this point in the history
  • Loading branch information
nateweller committed Jan 15, 2025
1 parent d9918e2 commit 92a84c5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions projects/packages/protect-models/src/class-threat-model.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public function __construct( $threat ) {
*
* @return string
*/
private static function get_id_from_vulnerable_extension( $extension, $vulnerabilities ) {
private static function get_id_from_vulnerable_extension( Extension_Model $extension, array $vulnerabilities ) {
// Create a single unique ID for the threat by hashing the extension and vulnerability IDs it contains.
return md5(
array_reduce(
Expand All @@ -177,7 +177,7 @@ function ( $carry, $vulnerability ) {
*
* @return string
*/
private static function get_title_from_vulnerable_extension( $extension ) {
private static function get_title_from_vulnerable_extension( Extension_Model $extension ) {
$titles = array(
'plugins' => sprintf(
/* translators: placeholders are the theme name and version number. Example: "Vulnerable theme: Jetpack (version 1.2.3)" */
Expand All @@ -204,7 +204,7 @@ private static function get_title_from_vulnerable_extension( $extension ) {
*
* @return string
*/
private static function get_description_from_vulnerable_extension( $extension, $vulnerabilities ) {
private static function get_description_from_vulnerable_extension( Extension_Model $extension, array $vulnerabilities ) {
return sprintf(
/* translators: placeholders are the theme name and version number. Example: "The installed version of Jetpack (1.2.3) has a known security vulnerability." */
_n( 'The installed version of %1$s (%2$s) has a known security vulnerability.', 'The installed version of %1$s (%2$s) has known security vulnerabilities.', count( $vulnerabilities ), 'jetpack-protect-models' ),
Expand All @@ -221,7 +221,7 @@ private static function get_description_from_vulnerable_extension( $extension, $
*
* @return Threat_Model
*/
public static function generate_from_extension_vulnerabilities( $extension, $vulnerabilities ) {
public static function generate_from_extension_vulnerabilities( Extension_Model $extension, array $vulnerabilities ) {
return new Threat_Model(
array(
'id' => self::get_id_from_vulnerable_extension( $extension, $vulnerabilities ),
Expand Down

0 comments on commit 92a84c5

Please sign in to comment.