/** * Tells if EventList has this event. * * Equality is based on line, column and code * * @param SQLI_CodeSniffer_Event $event */ public function hasEvent(SQLI_CodeSniffer_Event $event) { $lineColumnEvents = $this->getEvents($event->getLine(), $event->getColumn()); if (!empty($lineColumnEvents)) { foreach ($lineColumnEvents as $lineColumnEvent) { if ($lineColumnEvent->getCode() == $event->getCode()) { return true; } } } return false; }
/** * Gives the untreated config message for a given Event. * * @param SQLI_CodeSniffer_Event $event * * @return string */ protected function getEventMessage($event) { $event_code = $event->getCode(); if ($this->isConfiguredEventCode($event_code)) { return $this->configArray[$event_code]['message']; } else { return $event->getMessage(); } }
/** * Add an Event to the EventList * * @param string $code * @param mixed $messageOrParameters * @param int $stackPtr * @param int $level * * @return void */ public function addEvent($code, $messageOrParameters, $stackPtr = null, $level = null) { if (is_null($stackPtr)) { $lineNum = 1; $column = 1; } else { // _tokens are private ! $tokens = $this->getTokens(); $lineNum = $tokens[$stackPtr]['line']; $column = $tokens[$stackPtr]['column']; } if (is_null($level)) { $event = new SQLI_CodeSniffer_Event($lineNum, $column, $code, $messageOrParameters, $this->_activeListener); } else { $event = new SQLI_CodeSniffer_Event($lineNum, $column, $code, array(), $this->_activeListener); $event->setReportInfos($messageOrParameters, $level); } $this->_events->addEvent($event); }