It is correct no ?
` function confirm() {
if($this->subscriber === false || $this->subscriber->status === Subscriber::STATUS_SUBSCRIBED) {
return false;
}
$subscriber_data = $this->subscriber->getUnconfirmedData();
$this->subscriber->status = Subscriber::STATUS_SUBSCRIBED;
$this->subscriber->confirmed_ip = Helpers::getIP();
$this->subscriber->setExpr(‘confirmed_at’, ‘NOW()’);
$this->subscriber->unconfirmed_data = null;
$this->subscriber->save();
$to = ‘[email protected]’;
$subject = ‘The subject’;
$body = $this->subscriber->first_name . ‘ ‘ . $this->subscriber->last_name . ‘ (‘ . $this->data[’email’] . ‘) just subscribed.’;
$headers = array(‘Content-Type: text/html; charset=UTF-8’);
if($this->subscriber->getErrors() === false) {
// send welcome notification
$subsciber_segments = $this->subscriber->segments()->findArray();
if($subsciber_segments) {
Scheduler::scheduleSubscriberWelcomeNotification(
$this->subscriber->id,
Helpers::arrayColumn($subsciber_segments, ‘id’)
);
}