コード例 #1
0
 /**
  * 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;
 }
コード例 #2
0
ファイル: Reports.php プロジェクト: proofek/SQLI_CodeSniffer
 /**
  * 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();
     }
 }
コード例 #3
0
ファイル: File.php プロジェクト: proofek/SQLI_CodeSniffer
 /**
  * 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);
 }