if ($codigo == 1000)
{
$dadosCriados = $resposta->response->resData->children("urn:ietf:params:xml:ns:contact-1.0")->creData;
$mensagem['id'] = $dadosCriados->id;
$mensagem['dataCriacao'] = $dadosCriados->crDate;
return $mensagem;
}
else
{
echo "Erro - O contacto nao foi criado - A resposta foi: ".$codigo." - ".$result->msg;
}
$this->logout();
I have a logic issue that I would like to ask your help for.
On this code, I would like to return $mensagem but, as well, at the end, do the logout.
Right now, if I return $mensagem, the block execution ends, and nothing else is executed (I believe that this is the expected behavior). I cannot put the logout near the return $mensagem and before it because, it needs to be done, even if an error is returned.
Also, I cannot put return $mensagem; near the $this->logout(); line, because, if I do this, the $mensagem will be returned, even if an error occours, that we don’t want that…
It makes all the sense, because there is no such thing as a logout of something else that is not a login, hence, the verification can well stay on the logout function itself.
Thanks. (:
Is there a theoretical name for this sort of operation or it is something that practice will provide us?
Ups… sorry… my last reply was not correct, you say before… hm… Yes I believe I can, since each block of commands does their own login (how worst can I make it? :s).
However, I still need to verify if the login is in place, and if it is, then logout.