It is possible that the two code below gives different results?
This runs as i expected:
$message = new Message();
$cond = $message->getMessage();
$helper->log($cond);
if(!empty($cond)){
// do my stuff
}
This is where i start wondering why gave me different result:
$message = new Message();
$helper->log($message->getMessage());
if(!empty($message->getMessage())){
// do my stuff
}
All i modified is that i changed $cond variable to $message->getMessage().
This is the constrictor of the Message Class:
class Message {
private $input;
private $message;
public function Message()
{
$this->input = json_decode(file_get_contents('php://input'), true);
// ...
$this->message = $this->input['entry'][0]['messaging'][0]['message']['text'];
//...
}
}
And this is the getter method:
public function getMessage()
{
return $this->message;
}
getMessage()idempotent?