public function filter(CommitMessage $message) { $lines = explode("\n", $message->getMessage()); $lines = array_filter($lines, function ($line) { if (empty($line)) { return TRUE; } if ($line[0] != '#') { return TRUE; } return FALSE; }); $message->setMessage(implode("\n", $lines)); }
public function filter(CommitMessage $message) { // If message is a single line with 1-2 real words and 1 JIRA issue, // then use filterShortMessage $trimmedMessage = trim($message->getMessage(), "\r\n\t "); if (substr_count($trimmedMessage, "\n") == 0) { $words = $this->parseWords($trimmedMessage); if (count($words) >= 1 && count($words) <= 3) { $issueKeys = array_filter($words, array($this, 'isIssueKey')); if (count($issueKeys) == 1) { $message->setMessage($this->filterShortMessage($words)); return; } } } // Otherwise, use standard filter+footnotes parent::filter($message); }