original_string: public static function poify($string)
      {
          $quote = '"';
          $slash = '\\';
          $newline = "\n";
  
          $replaces = array(
              "$slash"    => "$slash$slash",
              "$quote"    => "$slash$quote",
              "\t"        => '\t',
          );
  
          $string = str_replace(
              array_keys($replaces),
              array_values($replaces),
              $string
          );
  
          $po = $quote . implode(
              "${slash}n$quote$newline$quote",
              explode($newline, $string)
          ) . $quote;
          // add empty string on first line for readbility
          if (false !== strpos($string, $newline) &&
                  (substr_count($string, $newline) > 1 ||
                  !($newline === substr($string, -strlen($newline))))) {
              $po = "$quote$quote$newline$po";
          }
          // remove empty strings
          $po = str_replace("$newline$quote$quote", '', $po);
  
          return $po;
      }
code: public static function poify($string)
      {
          $quote = '"';
          $slash = '\\';
          $newline = "\n";
  
          $replaces = array(
              "$slash"    => "$slash$slash",
              "$quote"    => "$slash$quote",
              "\t"        => '\t',
          );
  
          $string = str_replace(
              array_keys($replaces),
              array_values($replaces),
              $string
          );
  
          $po = $quote . implode(
              "${slash}n$quote$newline$quote",
              explode($newline, $string)
          ) . $quote;
          // add empty string on first line for readbility
          if (false !== strpos($string, $newline) &&
                  (substr_count($string, $newline) > 1 ||
                  !($newline === substr($string, -strlen($newline))))) {
              $po = "$quote$quote$newline$po";
          }
          // remove empty strings
          $po = str_replace("$newline$quote$quote", '', $po);
  
          return $po;
      }
code_tokens: public static function poify ( $ string ) { $ quote = '"' ; $ slash = '\\' ; $ newline = "\n" ; $ replaces = array ( "$slash" => "$slash$slash" , "$quote" => "$slash$quote" , "\t" => '\t' , ) ; $ string = str_replace ( array_keys ( $ replaces ) , array_values ( $ replaces ) , $ string ) ; $ po = $ quote . implode ( "${slash}n$quote$newline$quote" , explode ( $ newline , $ string ) ) . $ quote ; // add empty string on first line for readbility if ( false !== strpos ( $ string , $ newline ) && ( substr_count ( $ string , $ newline ) > 1 || ! ( $ newline === substr ( $ string , - strlen ( $ newline ) ) ) ) ) { $ po = "$quote$quote$newline$po" ; } // remove empty strings $ po = str_replace ( "$newline$quote$quote" , '' , $ po ) ; return $ po ; }
docstring: Formats a string in PO-style.
  
  @param string $string the string to format
  
  @return string the poified string
docstring_tokens: Formats a string in PO - style .