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

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