Code Duplication    Length = 16-16 lines in 2 locations

application/modules/cmsemail/classes/ParentEmail.php 2 locations

@@ 390-405 (lines=16) @@
387
            $this->theme = $pattern_settings['theme'];
388
            $this->message = $this->replaceVariables($pattern_settings['user_message'], $variables);
389
390
            if (!$this->_sendEmail()) {
391
                $this->errors[] = lang('User message doesnt send', 'cmsemail');
392
            } else {
393
                //Registering event is success
394
                Events::create()->registerEvent(
395
                    [
396
                     'from'       => $this->from,
397
                     'from_email' => $this->from_email,
398
                     'send_to'    => $this->send_to,
399
                     'theme'      => $this->theme,
400
                     'message'    => $this->message,
401
                    ],
402
                    'ParentEmail:userSend'
403
                );
404
                Events::runFactory();
405
            }
406
        }
407
        //Sending administrator email if active in options
408
        if ($pattern_settings['admin_message_active']) {
@@ 422-437 (lines=16) @@
419
            $this->message = $this->replaceVariables($pattern_settings['admin_message'], $variables);
420
            $this->attachment = $attachment;
421
422
            if (!$this->_sendEmail()) {
423
                $this->errors[] = lang('User message doesnt send', 'cmsemail');
424
            } else {
425
                //Registering event is success
426
                Events::create()->registerEvent(
427
                    [
428
                     'from'       => $this->from,
429
                     'from_email' => $this->from_email,
430
                     'send_to'    => $this->send_to,
431
                     'theme'      => $this->theme,
432
                     'message'    => $this->message,
433
                    ],
434
                    'ParentEmail:adminSend'
435
                );
436
                Events::runFactory();
437
            }
438
        }
439
440
        //Returning status