Code Duplication    Length = 5-13 lines in 3 locations

admin_pages/messages/Messages_Admin_Page.core.php 3 locations

@@ 1577-1585 (lines=9) @@
1574
		$templates = array();
1575
		$GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0;
1576
		//we need to make sure we've got the info we need.
1577
		if ( ! isset( $this->_req_data['msgr'], $this->_req_data['mt'], $this->_req_data['GRP_ID'] ) ) {
1578
			EE_Error::add_error(
1579
				__(
1580
					'In order to reset the template to its default we require the messenger, message type, and message template GRP_ID to know what is being reset.  At least one of these is missing.',
1581
					'event_espresso'
1582
				),
1583
				__FILE__, __FUNCTION__, __LINE__
1584
			);
1585
		}
1586
1587
		// all templates will be reset to whatever the defaults are
1588
		// for the global template matching the messenger and message type.
@@ 1659-1671 (lines=13) @@
1656
	 */
1657
	public function _preview_message( $send = false ) {
1658
		//first make sure we've got the necessary parameters
1659
		if (
1660
			! isset(
1661
				$this->_req_data['message_type'],
1662
				$this->_req_data['messenger'],
1663
				$this->_req_data['messenger'],
1664
				$this->_req_data['GRP_ID']
1665
			)
1666
		) {
1667
			EE_Error::add_error(
1668
				__('Missing necessary parameters for displaying preview', 'event_espresso'),
1669
				__FILE__, __FUNCTION__, __LINE__
1670
			);
1671
		}
1672
1673
		EE_Registry::instance()->REQ->set( 'GRP_ID', $this->_req_data['GRP_ID'] );
1674
@@ 3306-3310 (lines=5) @@
3303
	 *
3304
	 */
3305
	public function save_settings() {
3306
		if ( !isset( $this->_req_data['type'] ) ) {
3307
			EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
3308
			$this->_template_args['error'] = true;
3309
			$this->_return_json();
3310
		}
3311
3312
3313
		if ( $this->_req_data['type'] == 'messenger' ) {