/** * Client constructor. * @param Credential $credential * @param Pdo $pdo * @param Logger $logger */ public function __construct(Credential $credential, Pdo $pdo, Logger $logger) { $whatsprot = new WhatsProt($credential->username, $credential->nickname); $repository = new Messages($pdo); $this->receiver = new Receiver($whatsprot, $repository, $logger); $this->transmitter = new Transmitter($whatsprot, $repository, $logger); $this->receiver->registerCallbacks(); $this->transmitter->registerCallbacks(); $logger->log("connect to Whatsapp as {$credential->username}"); $whatsprot->connect(); $whatsprot->loginWithPassword($credential->password); $whatsprot->sendGetClientConfig(); $whatsprot->sendGetServerProperties(); $whatsprot->sendGetGroups(); $whatsprot->sendGetBroadcastLists(); }