예제 #1
0
 /**
  * @param SplitPosition $entry
  * @return string
  */
 public function createSpanEnd(SplitPosition $entry)
 {
     $highlight = $entry->getHighlight();
     $wrappendElement = "";
     if ($highlight) {
         $htmlElement = $highlight->getHtmlElement();
         if ($htmlElement) {
             $wrappendElement = $htmlElement->getClosingText();
         }
     }
     return $wrappendElement . '</span>';
 }
예제 #2
0
 /**
  * @param SplitPosition $entry
  * @return bool
  */
 protected function checkForAnchor(SplitPosition $entry)
 {
     $shouldShowAnchor = !$this->anchorDrawn && $entry->getHighlight()->getType() != Highlight::KEYWORD;
     if ($shouldShowAnchor) {
         $this->anchorDrawn = true;
     }
     return $shouldShowAnchor;
 }
 public function testCreateSpanStartWithPadding()
 {
     $this->splitPosition->shouldReceive('getLevel')->andReturn(-1);
     $result = $this->highlightRenderer->createSpanStart($this->splitPosition);
     assertThat($result, is("<span class=\"hi-match\" title=\"<infoText>\">"));
 }
예제 #4
0
 private function splitPositionEntrySorter(SplitPosition $a, SplitPosition $b)
 {
     $leftAction = $a->getAction();
     $rightAction = $b->getAction();
     $leftAction = $leftAction == SplitPosition::ATOM ? SplitPosition::START : $leftAction;
     $rightAction = $rightAction == SplitPosition::ATOM ? SplitPosition::START : $rightAction;
     if ($leftAction != $rightAction) {
         return strcasecmp($leftAction, $rightAction);
     } else {
         return ($leftAction == SplitPosition::START ? 1 : -1) * $this->compare($a->getLevel(), $b->getLevel());
     }
 }