* @param array $params
*
* @return array
+ * @throws CRM_Core_Exception
*/
public static function create($params) {
$statusPreference = new CRM_Core_BAO_StatusPreference();
$params['ignore_severity'] = CRM_Utils_Check::severityMap($params['ignore_severity']);
}
if ($params['ignore_severity'] > 7) {
- CRM_Core_Error::fatal(ts('You can not pass a severity level higher than 7.'));
+ throw new CRM_Core_Exception(ts('You can not pass a severity level higher than 7.'));
}
// If severity is now blank, you have an invalid severity string.
if (is_null($params['ignore_severity'])) {
- CRM_Core_Error::fatal(ts('Invalid string passed as severity level.'));
+ throw new CRM_Core_Exception(ts('Invalid string passed as severity level.'));
}
// Check if this StatusPreference already exists.
$statusPreference->copyValues($params);
- $edit = ($statusPreference->id) ? TRUE : FALSE;
+ $edit = (bool) $statusPreference->id;
if ($edit) {
CRM_Utils_Hook::pre('edit', 'StatusPreference', $statusPreference->id, $statusPreference);
}