original_string: protected function addNewWords($allWords)
      {
          try {
              $newWords = $allWords;
              $query = (new Query())->from(Vocabulary::tableName())->where(['word' => $allWords]);
              foreach ($query->each() as $vocabularyFound) {
                  if (($key = array_search($vocabularyFound['word'], $allWords)) !== false) {
                      unset($newWords[$key]);
                  }
              }
              $formatWords = [];
              foreach ($newWords as $word) {
                  $formatWords[] = [$word];
              }
              if (!empty($formatWords)) {
                  if (!Podium::getInstance()->db->createCommand()->batchInsert(
                          Vocabulary::tableName(), ['word'], $formatWords
                      )->execute()) {
                      throw new Exception('Words saving error!');
                  }
              }
          } catch (Exception $e) {
              Log::error($e->getMessage(), null, __METHOD__);
              throw $e;
          }
      }
code: protected function addNewWords($allWords)
      {
          try {
              $newWords = $allWords;
              $query = (new Query())->from(Vocabulary::tableName())->where(['word' => $allWords]);
              foreach ($query->each() as $vocabularyFound) {
                  if (($key = array_search($vocabularyFound['word'], $allWords)) !== false) {
                      unset($newWords[$key]);
                  }
              }
              $formatWords = [];
              foreach ($newWords as $word) {
                  $formatWords[] = [$word];
              }
              if (!empty($formatWords)) {
                  if (!Podium::getInstance()->db->createCommand()->batchInsert(
                          Vocabulary::tableName(), ['word'], $formatWords
                      )->execute()) {
                      throw new Exception('Words saving error!');
                  }
              }
          } catch (Exception $e) {
              Log::error($e->getMessage(), null, __METHOD__);
              throw $e;
          }
      }
code_tokens: protected function addNewWords ( $ allWords ) { try { $ newWords = $ allWords ; $ query = ( new Query ( ) ) -> from ( Vocabulary :: tableName ( ) ) -> where ( [ 'word' => $ allWords ] ) ; foreach ( $ query -> each ( ) as $ vocabularyFound ) { if ( ( $ key = array_search ( $ vocabularyFound [ 'word' ] , $ allWords ) ) !== false ) { unset ( $ newWords [ $ key ] ) ; } } $ formatWords = [ ] ; foreach ( $ newWords as $ word ) { $ formatWords [ ] = [ $ word ] ; } if ( ! empty ( $ formatWords ) ) { if ( ! Podium :: getInstance ( ) -> db -> createCommand ( ) -> batchInsert ( Vocabulary :: tableName ( ) , [ 'word' ] , $ formatWords ) -> execute ( ) ) { throw new Exception ( 'Words saving error!' ) ; } } } catch ( Exception $ e ) { Log :: error ( $ e -> getMessage ( ) , null , __METHOD__ ) ; throw $ e ; } }
docstring: Adds new tag words.
  @param string[] $allWords All words extracted from post
  @throws Exception
docstring_tokens: Adds new tag words .