Example #1
0
 /**
  * Handle the no-parse for given text.
  *
  * @param string $text
  * @param array  $pluginWhiteList
  *
  * @return LimelightResults
  *
  * @throws InvalidInputException
  */
 public function handle($text, array $pluginWhiteList)
 {
     if ($this->hasKanji($text)) {
         throw new InvalidInputException('Text must not contain kanji.');
     }
     $token = $this->buildToken($text);
     $properties = $this->buildProperties();
     $words = [new LimelightWord($token, $properties, $this->limelight)];
     $this->dispatcher->fire('WordWasCreated', $words[0]);
     $pluginResults = $this->runPlugins($text, null, $token, $words, $pluginWhiteList);
     $results = new LimelightResults($text, $words, $pluginResults);
     $this->dispatcher->fire('ParseWasSuccessful', $results);
     return $results;
 }
Example #2
0
 /**
  * Make new word and append it to words array.
  *
  * @param array $current
  * @param array $properties
  */
 private function makeNewWord($current, $properties)
 {
     $word = new LimelightWord($current, $properties, $this->limelight);
     $this->dispatcher->fire('WordWasCreated', $word);
     $this->words[] = $word;
 }