class RedmineEmailGrabber extends Redmine { /** * @param string $subject * @return int */ public function getTicketIdFromSubject( $subject ) { $pattern = '/([\w\s]*)\s-\s[A-z]*\s#(?P\d*)/'; if( preg_match( $pattern, $subject, $matches ) ) { if( count( $matches ) === 4 ) { return $matches['TicketId']; } } return 0; } /** * @param integer $id * @param string $note * @throws Exception */ public function addNoteToIssue( $id, $note ) { $issue = $this->getIssue( $id ); $issue->notes = substr( $note, 0, 3000 ); // ab 3.000 Zeichen gibt es einen "500 internal Server Error" $this->updateIssue( $issue, $id ); } }