public function attach($returnUrl = null)
{
if ($this->isAttached()) {
return;
}
if ($returnUrl === true) {
$protocol = !empty($_SERVER['HTTPS']) ? 'https://' : 'http://';
$returnUrl = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
}
$params = ['return_url' => $returnUrl];
$url = $this->getAttachUrl($params);
header("Location: {$url}", true, 307);
echo "You're redirected to <a href='{$url}'>{$url}</a>";
exit;
}