Skip to content

alternative way of exit and die in magento

i want to stop further executions of magento but without using exit, this is a PHP CS issue, how can i? i used return but execution did not stop,

public function aroundOnThreeDSRequired(
P3PaymentGatewayModelMethodP3Method $subject,
Closure $proceed,
$threeDSVersion,
$res) {
setcookie(‘threeDSRef’, $res[‘threeDSRef’], time()+315);

    $connection = $this->resourceConnection->getConnection();
    
    $connection = $this->resourceConnection->getConnection();
    $tableName = $this->resourceConnection->getTableName('payment_gateway_cookies'); //gives table name with prefix

    $order_num= $this->request->getParam('trRef');
    $sql = "Insert Into " . $tableName . " ( value,order_number) Values ('".$res['threeDSRef']."','". $order_num."' )";
    $connection->query($sql);
   
    // check for version
   $html =  Gateway::silentPost($res['threeDSURL'], $res['threeDSRequest']);

    if ($threeDSVersion >= 200) {
        // Silently POST the 3DS request to the ACS in the IFRAME
        // Remember the threeDSRef as need it when the ACS responds
        $_SESSION['threeDSRef'] = $res['threeDSRef'];
    }
     $this->response
        ->setHeader('Content-Type', 'text/html', true)
        ->setBody($html)
        ->sendResponse();
    exit;
}