Code Duplication    Length = 14-15 lines in 2 locations

models/ContactForm.php 1 location

@@ 67-80 (lines=14) @@
64
     * 
65
     * @return bool whether the model passes validation
66
     */
67
    public function contact($email)
68
    {
69
        if ($this->validate()) {
70
            Yii::$app->mailer->compose()
71
                ->setTo($email)
72
                ->setFrom([$this->email => $this->name])
73
                ->setSubject($this->subject)
74
                ->setTextBody($this->body)
75
                ->send();
76
77
            return true;
78
        }
79
        return false;
80
    }
81
}
82

models/Feedback.php 1 location

@@ 176-190 (lines=15) @@
173
     *
174
     * @return bool whether the model passes validation
175
     */
176
    public function contact($email)
177
    {
178
        if ($this->save()) {
179
            Yii::$app->mailer->compose()
180
                ->setTo($email)
181
                ->setFrom([$this->email => $this->name])
182
                ->setSubject('New message from bizness-develop feedback. ' . $this->subject)
183
                ->setTextBody($this->message)
184
                ->send();
185
186
            return true;
187
        }
188
189
        return false;
190
    }
191
}
192