/** * Handle user issues * * @return void */ public function handleUserIssues() { $user = $this->getUserData(); if (!$user) { return; } $key = $this->_userKey->setId($user[Chat::COLUMN_REDMINE_KEY_ID])->load(); $redmineIssues = $this->_getRedmineIssues($key[UserKey::COLUMN_KEY]); $redmineIssueNumbers = $this->_issueHelper->getIssueNumbers($redmineIssues); $currentIssueNumbers = $this->_getIssueNumbers($this->_getCurrentIssues()); $newIssueNumbers = $this->_getNewIssueNumbers($redmineIssueNumbers, $currentIssueNumbers); if (!$newIssueNumbers) { return; } $keyId = $key[$this->_userKey->getPrimaryKey()]; $this->_deleteIssuesByKey($keyId); $this->_saveIssues($keyId, $redmineIssueNumbers); $newIssuesData = $this->_getIssuesDataByNumbers($newIssueNumbers, $redmineIssues); foreach ($newIssuesData as $newIssue) { $this->_botApi->sendMessage($user[Chat::COLUMN_CHAT_ID], $this->_getMessageForNewIssue($newIssue)); } }
/** * Notify * * @param integer $chatId Chat ID * @param string $message Message * * @return void */ protected function _notify($chatId, $message) { $this->_botApi->sendMessage($chatId, $message); }