original_string: protected function _filterText($text)
      {
          // return true means `yes, it's banned`
          if (is_callable($this->config('bannedWords'))) {
              $isBanned = function ($word) {
                  $callable = $this->config('bannedWords');
  
                  return $callable($word);
              };
          } else {
              $isBanned = function ($word) {
                  return in_array($word, (array)$this->config('bannedWords')) || empty($word);
              };
          }
  
          $words = explode(' ', $text);
          foreach ($words as $i => $w) {
              if ($isBanned($w)) {
                  unset($words[$i]);
              }
          }
  
          return implode(' ', $words);
      }
code: protected function _filterText($text)
      {
          // return true means `yes, it's banned`
          if (is_callable($this->config('bannedWords'))) {
              $isBanned = function ($word) {
                  $callable = $this->config('bannedWords');
  
                  return $callable($word);
              };
          } else {
              $isBanned = function ($word) {
                  return in_array($word, (array)$this->config('bannedWords')) || empty($word);
              };
          }
  
          $words = explode(' ', $text);
          foreach ($words as $i => $w) {
              if ($isBanned($w)) {
                  unset($words[$i]);
              }
          }
  
          return implode(' ', $words);
      }
code_tokens: protected function _filterText ( $ text ) { // return true means `yes, it's banned` if ( is_callable ( $ this -> config ( 'bannedWords' ) ) ) { $ isBanned = function ( $ word ) { $ callable = $ this -> config ( 'bannedWords' ) ; return $ callable ( $ word ) ; } ; } else { $ isBanned = function ( $ word ) { return in_array ( $ word , ( array ) $ this -> config ( 'bannedWords' ) ) || empty ( $ word ) ; } ; } $ words = explode ( ' ' , $ text ) ; foreach ( $ words as $ i => $ w ) { if ( $ isBanned ( $ w ) ) { unset ( $ words [ $ i ] ) ; } } return implode ( ' ' , $ words ) ; }
docstring: Removes any invalid word from the given text.
  
  @param string $text The text to filter
  @return string Filtered text
docstring_tokens: Removes any invalid word from the given text .