diff --git a/includes/formatters/BasicFormatter.php b/includes/formatters/BasicFormatter.php index 761c2745f..d973acbaa 100644 --- a/includes/formatters/BasicFormatter.php +++ b/includes/formatters/BasicFormatter.php @@ -46,14 +46,6 @@ class EchoBasicFormatter extends EchoNotificationFormatter { */ protected $language; - /** - * Required parameters - * @param array - */ - protected $requiredParameters = array ( - 'title-message' - ); - /** * Data for constructing bundle message, data in this array * should be used in function processParams() @@ -75,6 +67,11 @@ class EchoBasicFormatter extends EchoNotificationFormatter { public function __construct( $params ) { parent::__construct( $params ); + if ( !isset( $params['title-message'] ) ) { + // Required, no default value set + throw new InvalidArgumentException( "'title-message' parameter not set" ); + } + // Set up default params if any are missing $params = $this->setDefaultParams( $params ); diff --git a/includes/formatters/NotificationFormatter.php b/includes/formatters/NotificationFormatter.php index 10e105127..3bd0d89b5 100644 --- a/includes/formatters/NotificationFormatter.php +++ b/includes/formatters/NotificationFormatter.php @@ -37,11 +37,6 @@ abstract class EchoNotificationFormatter { */ protected $parameters; - /** - * List of parameters that must exist in $this->$parameters - */ - protected $requiredParameters = array(); - /** * Creates an instance of the given class with the given parameters. * @param $parameters array Associative array of parameters @@ -49,16 +44,6 @@ abstract class EchoNotificationFormatter { */ public function __construct( array $parameters ) { $this->parameters = $parameters; - - $missingParameters = array_diff( $this->requiredParameters, array_keys( $parameters ) ); - - if ( $missingParameters ) { - throw new MWException( - "Missing required parameters for " . - get_class( $this ) . ":" . - implode( " ", $missingParameters ) - ); - } } /**