/**
  * Get HTML with the list of block that apply for given text
  *
  * @param $blockText string text to be test against all blocks
  * @return string HTML
  */
 private function handleBlockTest($blockText)
 {
     wfProfileIn(__METHOD__);
     $service = new PhalanxService();
     $service->setLimit(20);
     $listing = '';
     $noMatches = true;
     foreach (Phalanx::getAllTypeNames() as $blockType) {
         $res = $service->match($blockType, $blockText);
         if (empty($res)) {
             continue;
         }
         $noMatches = false;
         $pager = new PhalanxBlockTestPager($blockType);
         $pager->setRows($res);
         $listing .= $pager->getHeader();
         $listing .= $pager->getBody();
     }
     if ($noMatches) {
         $pager = new PhalanxBlockTestPager(0);
         $listing .= $pager->getEmptyBody();
     }
     wfProfileOut(__METHOD__);
     return $listing;
 }
 /**
  * testBlock
  *
  * performs a test of all available phalanx filters and returns warning message if there are any
  * @author Kamil Koterba <*****@*****.**>
  *
  * @param $text String to match
  * @return String with HTML to display via AJAX
  */
 public static function testBlock($text)
 {
     wfProfileIn(__METHOD__);
     if (!class_exists('PhalanxService')) {
         wfProfileOut(__METHOD__);
         return '';
     }
     $service = new PhalanxService();
     $blockFound = false;
     foreach (Phalanx::getAllTypeNames() as $blockType) {
         $res = $service->match($blockType, $text);
         if (!empty($res)) {
             $blockFound = true;
             break;
         }
     }
     $warning = '';
     if ($blockFound) {
         $phalanxTestTitle = SpecialPage::getTitleFor('Phalanx', 'test');
         $linkToTest = Linker::link($phalanxTestTitle, wfMessage('userrenametool-see-list-of-blocks')->escaped(), [], ['wpBlockText' => $text]);
         $warning = wfMessage('userrenametool-warning-phalanx-block', $text)->rawParams($linkToTest)->escaped();
     }
     wfProfileOut(__METHOD__);
     return $warning;
 }