src/Base64.php
public static function encode(
    /*string*/ $string,
    /*boolean*/ $oneLine = true
  ) {
    if(!self::isEncoded($string)) {
      $string = base64_encode($string);
    }
    if($string && $oneLine) {
      $string = str_replace(["\r", "\n"], '', $string);
    }
    return $string;
  }
public static function encode(
    /*string*/ $string,
    /*boolean*/ $oneLine = true
  ) {
    if(!self::isEncoded($string)) {
      $string = base64_encode($string);
    }
    if($string && $oneLine) {
      $string = str_replace(["\r", "\n"], '', $string);
    }
    return $string;
  }
public static function encode ( /*string*/ $ string , /*boolean*/ $ oneLine = true ) { if ( ! self :: isEncoded ( $ string ) ) { $ string = base64_encode ( $ string ) ; } if ( $ string && $ oneLine ) { $ string = str_replace ( [ "\r" , "\n" ] , '' , $ string ) ; } return $ string ; }
Encodes the specified string as Base64. Note that a previously-encoded
string will not be re-encoded.

@param string $string to encode
@param boolean $oneLine TRUE to return result as a single, long line
@return string Base64-encoded string
Encodes the specified string as Base64 . Note that a previously - encoded string will not be re - encoded .