private function initCommander() { $interactor = new MultiCurlInteractor(); $interactor->setResponseFactory(new SlackResponseFactory()); $token = $this->getToken($this->teamId); if (!empty($token)) { $this->commander = new CustomCommander($token, $interactor); } }
public function addToken($token) { if (empty($token)) { return; } $interactor = new MultiCurlInteractor(); $interactor->setResponseFactory(new SlackResponseFactory()); $tempCommander = new CustomCommander($token, $interactor); $auth = $tempCommander->execute('auth.test')->getBody(); if (Utils::getWorkflows()->setPassword('token.' . $auth['team_id'], $token)) { $this->addTeam($auth); // If safe password is set, remove the unsafe one Utils::getWorkflows()->delete('token.' . $auth['team_id']); $this->services[$auth['team_id']] = new SingleTeamSlackService($auth['team_id']); } }