I'm working on something that script need to wait for do childFunc and after that return the result of childFunc and after that, the script continue. Something like async and await in javascript.
<?php
$loginResponse = $system->login($username, $password);
if ($loginResponse !== null && $loginResponse->isTwoFactorRequired()) {
$twoFactorIdentifier = $loginResponse->TwoFactorInfo()->getTwoFactorIdentifier();
// I need to wait here that myChaildFucn LoadView and get data from user and then after some process retuen result!!!!
$verificationCode = myChaildFucn();
$system->checkTwoFactorLogin($username, $password, $twoFactorIdentifier, $verificationCode,);
}