original_string: protected function getKeywordsForRegex(array $keywords, $delimiter = '/')
      {
          // escape keywords for use in regex
          $delimiter = array_fill(0, count($keywords), $delimiter);
          $escaped = array_map('preg_quote', $keywords, $delimiter);
  
          // add word boundaries
          array_walk($keywords, function ($value) {
              return '\b'.$value.'\b';
          });
  
          $keywords = array_combine($keywords, $escaped);
  
          return $keywords;
      }
code: protected function getKeywordsForRegex(array $keywords, $delimiter = '/')
      {
          // escape keywords for use in regex
          $delimiter = array_fill(0, count($keywords), $delimiter);
          $escaped = array_map('preg_quote', $keywords, $delimiter);
  
          // add word boundaries
          array_walk($keywords, function ($value) {
              return '\b'.$value.'\b';
          });
  
          $keywords = array_combine($keywords, $escaped);
  
          return $keywords;
      }
code_tokens: protected function getKeywordsForRegex ( array $ keywords , $ delimiter = '/' ) { // escape keywords for use in regex $ delimiter = array_fill ( 0 , count ( $ keywords ) , $ delimiter ) ; $ escaped = array_map ( 'preg_quote' , $ keywords , $ delimiter ) ; // add word boundaries array_walk ( $ keywords , function ( $ value ) { return '\b' . $ value . '\b' ; } ) ; $ keywords = array_combine ( $ keywords , $ escaped ) ; return $ keywords ; }
docstring: We'll strip whitespace around certain keywords with regular expressions.
  This will prepare the given array by escaping all characters.
  
  @param string[] $keywords
  @param string   $delimiter
  
  @return string[]
docstring_tokens: We ll strip whitespace around certain keywords with regular expressions . This will prepare the given array by escaping all characters .