original_string: public static function substrToString($haystack, $needle, $case_sensitive = true)
      {
          $compare_func = $case_sensitive ? 'mb_strpos' : 'mb_stripos';
  
          if (static::contains($haystack, $needle, $case_sensitive)) {
              return mb_substr($haystack, 0, $compare_func($haystack, $needle, $case_sensitive));
          }
  
          return $haystack;
      }
code: public static function substrToString($haystack, $needle, $case_sensitive = true)
      {
          $compare_func = $case_sensitive ? 'mb_strpos' : 'mb_stripos';
  
          if (static::contains($haystack, $needle, $case_sensitive)) {
              return mb_substr($haystack, 0, $compare_func($haystack, $needle, $case_sensitive));
          }
  
          return $haystack;
      }
code_tokens: public static function substrToString ( $ haystack , $ needle , $ case_sensitive = true ) { $ compare_func = $ case_sensitive ? 'mb_strpos' : 'mb_stripos' ; if ( static :: contains ( $ haystack , $ needle , $ case_sensitive ) ) { return mb_substr ( $ haystack , 0 , $ compare_func ( $ haystack , $ needle , $ case_sensitive ) ) ; } return $ haystack ; }
docstring: Returns the substring of a string up to a specified needle.  if not found, return the whole haystack
  
  @param string $haystack
  @param string $needle
  @param bool $case_sensitive
  
  @return string
docstring_tokens: Returns the substring of a string up to a specified needle . if not found return the whole haystack